I want to move a DB structure from Oracle 11g to HSQLDB embedded throught java code.
I create the Oracle DB in SQL Developer, then mapping the DB throught NetBeans in java class.
Now I want to create from this structure an embedded DB in HSQLDB at the run of my application.
I have a problem with a primary key generate in oracle with an trigger-sequence (auto-increment).
For the oracle 11g I identify the column with the tag @ReturnInsert, to have the value of the primary key returned after the persist command, but that isn't supported for the HSQLDB, and then the HSQLDB don't have defined the sequence-trigger elements.
The creation of HSQLDB from the java code works fine if instead of @ReturnInsert I used
You would be better off using the same sequence generator in Oracle, than using your trigger assigned sequence. It would be much more efficient.
If you want to have different metadata for different databases, you can use a different persistence unit, or persistence.xml and add any changes in an orm.xml.
You could also modify the ClassDescriptors in code using a DescriptorCustomizer, or SessionCustomizer depending on what database you are connecting to.