File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Auto Generated Primary Key Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Auto Generated Primary Key" Watch "Auto Generated Primary Key" New topic
Author

Auto Generated Primary Key

John Rainey
Greenhorn

Joined: Dec 05, 2002
Posts: 17
I have a database table with 3 columns:
1. id
2. name
3. text

The id - primary key - is being generated by the database as a sequential key. I'm confused about how to implement this field in my cmp entity bean. During the ejbCreate, I can't set the field since it's being generated by the database.

thanks for your help.
yc lim
Greenhorn

Joined: Jul 26, 2004
Posts: 14
try setting the value as null or 0, it works for me on MySQL
Arun Prasath
Ranch Hand

Joined: Sep 17, 2003
Posts: 192
Hi,
which application server are you using?
I am using weblogic 6 sp3 and I am able to generate CMP on a table whose primary key is a sequence by mentioning its details in weblogic-cmp-rdbms-jar.xml

Look into your application server's documentation.


SCJP 1.4, SCDJWS , SCJA<br />I can do ALL things through CHRIST who strengthens me.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Auto Generated Primary Key
 
Similar Threads
How do DB-Auto-Generated Primary Key in EJB 2.0?
What is the better choice for primary key ? natural key or system-generated key ?
Duplicated rows on the database
I am getting null value for particular column, while loading the object.
composite-id in Hibernate