[jboss-user] [EJB 3.0] - Re: @GeneratedValue(strategy=GenerationType.AUTO) for oracle
oskar.carlstedt
do-not-reply at jboss.com
Tue Jul 15 10:08:52 EDT 2008
Hi!
I haven not read all posts but I know the following works with Oracle.
1. Annotate your entity with @Entity as normal.
2. Annotate your ID column with @Id. @GeneratedValue(strategy=GenerattionType.AUTO, generator="seqMyObject"), @SequenceGenerator(name="seqMyObject", sequenceMame="SEQ_MY_OBJECT")
|
| @Entity
| public class MyObject {
|
| @Id
| @GeneratedValue(strategy=GenerationType.AUTO, generator="seqMyObject")
| @SequenceGenerator(name="seqMyObject", sequenceName="SEQ_MY_OBJECT")
| private Long id;
|
| ...
|
| }
|
|
This shall work. As previous posts said it shall also be possible to put the sequenceGenerator annotation in the class but in my point of view it looks better to put it on the id property.
Cheers,
Oskar
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4164503#4164503
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4164503
More information about the jboss-user
mailing list