• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

AutoIncrement primaryKey

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic