I’ve had a project where I need to migrate from using MySQL to Oracle going on at the moment.
Oracle uses Sequencers, but fortunately the Java code had been implemented (I believe) using Java Persistence API. Hence the annotations need changing to:
Provided the generator attribute on the 1st line matches the name on the second, and then the sequence name attribute matches the sequencer name in the database. The allocationSize is also required if the increment size is specified in the database.
Once this had been updated for all necessary classes, upon deploying to the GlassFish server (v2 I believe), I encountered this error:
Exception Description: An exception was thrown while loading class <myclassname>: to check whether it implements @Entity, @Embeddable, or @MappedSuperclass
After much searching around, it appears its a bug in GlassFish v2. To solve it, restart the application server, and then redeploy the application. (Much thanks to: http://screwdriver.felk.cvut.cz/mediawiki/index.php/J2ee_troubleshooting)