This content has been marked as final.
Show 2 replies
-
1. Re: EJB 3.0 - PK Generation with GenerationType
ablevine1 Sep 12, 2006 9:02 PM (in response to wikijuarezjunior)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") -
2. Re: EJB 3.0 - PK Generation with GenerationType
wikijuarezjunior Sep 13, 2006 9:21 AM (in response to wikijuarezjunior)Hi ablevine1,
Thanks a lot for you reply. I will check those Hibernate extensions and give them a try.
BR,
Juarez Jr