Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Oracle11g-HSQLDB(Migration DB)
Oracle11g-HSQLDB [message #813629] Mon, 05 March 2012 14:28 Go to next message
pdvmipv Mising name is currently offline pdvmipv Mising nameFriend
Messages: 12
Registered: October 2010
Junior Member
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

@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EMP_SEQ")
@SequenceGenerator(name="EMP_SEQ", sequenceName="EMP_SEQ", allocationSize=100)

but this code isn't correct for me to use in OracleCode because i want to use the trigger for my centralized db (oracle).

There is a way to customize my java class entity to define in different way the same field (primary key)???.

Someone can suggest my how to work?

Re: Oracle11g-HSQLDB [message #813747 is a reply to message #813629] Mon, 05 March 2012 17:06 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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.


James : Wiki : Book : Blog : Twitter
Previous Topic:Relation between Mulitple instance of EntityManagerFactory
Next Topic:QueryException occurs on an expression that is using getAllowingNull() on an aggregate attribute.
Goto Forum:
  


Current Time: Thu Mar 28 22:49:15 GMT 2024

Powered by FUDForum. Page generated in 0.04472 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top