04 July 2003 - java_dev (original) (raw)

11:53 am - stipe - EJBs, Primary Keys, XDoclet, and JBoss I've got an entity bean for which I want to have an automatically generated primary key field. If I was just making entries into a database table, an auto-increment column would be what I wanted, but I really don't care how the key value is generated, so long as it's unique. I assume there must be a way to do this with an EJB, but nothing I've tried has worked so far (specifically, not specifying a value for the pk field during creation, and what I mention below).I'm using XDoclet to generate my ejb-jar.xml and jbosscmp-jdbc.xml, and I'm presently trying to use "@jboss.persistence auto-increment='true'", but I then get "java.lang.IllegalStateException: auto-increment template not found" on deployment.I'm kinda stuck. Any ideas?Update: Problem solved. XDoclet can helpfully generate util classes to generate GUIDs that can be used as primary keys.