[jboss-user] [EJB 3.0] - Re: EJB 3.0 - PK Generation with GenerationType

ablevine1 do-not-reply at jboss.com
Tue Sep 12 21:02:37 EDT 2006


There is no way to do this that is ejb3-spec compliant, however, you can use some hibernate extensions to accomplish this.

1. You need create an id genretor class that implements org.hibernate.id.IdentifierGenerator implementing the generate method to return your custom generated pk.

2. Annotate the primary key getter method for you ejb with the following
@Id
@Column(name = "ID")
@GeneratedValue(generator = "myCustomIDGen")
@GenericGenerator(name = "myCustomIDGen", strategy = "full_classname_of_your_IdentifierGenerator_implementation")

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971157#3971157

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971157



More information about the jboss-user mailing list