1

In eclipse I configured a database connection and I set up my JPA project to use it. In my entity classes, I get the following error: Schema "ROOT" cannot be resolved for table "XXX"

In the project's JPA settings, there is a check box to "Override default schema from connection" with the schema set to "ROOT" by default. I can not change that because when I check the checkbox, the schema dropdown is empty.

How do I force eclipse to use the correct schema? What is the correct schema name anyway? I only know the database / catalog name.

ventsyv
  • 3,316
  • 3
  • 27
  • 49
  • possible duplicate of [How to set up default schema name in JPA configuration?](http://stackoverflow.com/questions/2737420/how-to-set-up-default-schema-name-in-jpa-configuration) – Arpit Aggarwal Jul 06 '15 at 21:57
  • @Arpit Not a duplicate. The question is about Eclipse's, not Hibernate's, default schema. :-) – Brian Vosburgh Jul 07 '15 at 01:50
  • What is your database? MySQL? Oracle? Dali (the Eclipse plug-in that provides JPA tooling) depends on DTP (yet another Eclipse plug-in) to provide the metadata used to validate your mappings. Sometimes DTP's handling of various databases can be problematic... Can you see your database/catalog/schema and tables in the Data Source Explorer? This can help us understand how DTP is mapping your database metadata and how we might configure Dali to use it. – Brian Vosburgh Jul 07 '15 at 01:55
  • I'm using MySQL. I see the catalog in the Data Source Explorer but no tables. – ventsyv Jul 07 '15 at 12:52
  • I set up a Hibernate Code Generation Configuration (Run->Hibernate Code Generation) and the errors are now gone. – ventsyv Jul 07 '15 at 17:03

1 Answers1

0

You can set the default schema in the JPA properties for hibernate

<prop key="hibernate.default_schema">application_schema</prop>
yayatip
  • 69
  • 1
  • 5