4

I am using OpenJPA and HSQLDB for my current project.

But I am unable to generate JPA entities from the HSQLDB because eclipse plugin is not giving me an option to select the schema.

Does anybody have idea about this? Or is there any other way to generate entities in eclipse?

Karen Butzke
  • 1,442
  • 12
  • 18
Satya
  • 2,094
  • 6
  • 37
  • 60

1 Answers1

10

I am assuming that you are using the "standard" JPA tooling (JPT), since you are not specifying otherwise.

First, you need to define a connection (in the Data Source Exlporer). You should be able to drill down and see the actual tables you need to work with:

alt text

You select the schema on the "JPA Facet" page when you create the JPA project or activate the JPA Facet: There is a checkbox called "Override default schema from connection", and a combo-box where you select the "Schema":

Screen shot of the JPA Facet property page

You can even select the schema when you ask to generate entities (right click on the project, JPA Tools > Generate Entities from Tables...), and then you get this dialog: Dialog where you can select a different schema

Happy Mapping!

JesperSM
  • 1,418
  • 1
  • 11
  • 15
  • 1
    All above mentioned steps were followed but I was unable to select my custom schema. One deviation from your steps : in JPA implementation, I am using the "user library" option and adding OpenJPA libraries. – Satya Jan 16 '11 at 07:59
  • 4
    I had to "override the default catalog from connection" also to select my custom schema. Now it works fine. – Satya Jan 16 '11 at 19:04
  • The key is check the "Override default catalog from connection" as @Satya says. – Luis Manrique Aug 29 '21 at 14:58