jQuery in Action, 2nd edition*
The moose likes JBoss/WildFly and the fly likes AutoIncrement primaryKey Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "AutoIncrement primaryKey" Watch "AutoIncrement primaryKey" New topic
Author

AutoIncrement primaryKey

Mukti Furtado
Greenhorn

Joined: Oct 17, 2003
Posts: 9
Hello,

I want to automatically increment the primary key field in the database(MySql) in a CMP bean. I have written the following lines in the jbosscmp-jdbc.xml
<unknown-pk>
<unknown-pk-class>java.lang.Integer</unknown-pk-class>
<field-name>userID</field-name>
<column-name>userID</column-name>
<jdbc-type>INTEGER</jdbc-type>
<sql-type>INT(11)</sql-type>
<auto-increment/>
</unknown-pk>
<entity-command name="mysql-get-generated-keys"/>
But when i get a Nullpointer exception when i try to insert a record through my CMP.
Can you please tell me where i am going wrong
Thanks
Yuan Ye
Ranch Hand

Joined: Mar 05, 2003
Posts: 172
looks like you need the class name and method to be defined for the entity-command. You can refer to the following link.
http://www.coredevelopers.net/library/jboss/cmp/keygen.jsp#mysql
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AutoIncrement primaryKey
 
Similar Threads
Strange deploy error
lomboz
CMP beans not entering data in database
CMP 2.0 with oracle-sequence and composite primary key
Entity Bean on JBoss4.0.2