[jboss-user] [EJB 3.0] - SequenceGenerator and the correct annotation syntax?
pieterjan
do-not-reply at jboss.com
Mon Nov 20 06:55:09 EST 2006
Hi,
I finally got my entity beans working the way I want. But I found that to get the sequence working, I had to use the following annotations (look at the GeneratedValue annotation):
@Entity
| @Table(name = "t_investigators",
| schema = "dryice"
| )
| @SequenceGenerator(name = "InvestigatorBeanSequence", sequenceName = "s_investigators")
| public class InvestigatorBean implements Investigator, Serializable {
|
| @Id
| @GeneratedValue(generator = "InvestigatorBeanSequence")
| @Column(name = "id")
| private long tableId;
But according the JSR 220 specs (regarding persistence) the following should work (see example 1 chapter 9.1.9: GeneratedValue Annotation) but it doesn't:
@Entity
| @Table(name = "t_investigators",
| schema = "dryice"
| )
| @SequenceGenerator(name = "InvestigatorBeanSequence", sequenceName = "s_investigators")
| public class InvestigatorBean implements Investigator, Serializable {
|
| @Id
| @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "InvestigatorBeanSequence")
| @Column(name = "id")
| private long tableId;
I had to leave out the strategy to get things working. Is this normal?
-- pj
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987265#3987265
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987265
More information about the jboss-user
mailing list