(***Please don't post these questions to ejb-container-group***).
This is the code you need in your ejbPostCreate:
DataSource ds = <get data source somehow>
int iKey = <lookup new autonumbered value from database via SQL>
this.TheKey = iKey;
MyBeanPK pk = (MyBeanPK)this.CachedEntityContext.getPrimaryKey();
pk.TheKey = iKey;
where your EJB is called MyBean, and the autonumbered field is called
TheKey, and you have stored the entity context in a member called
CachedEntityContext.
Joe
-----Original Message-----
From: Ritesh [SMTP:[EMAIL PROTECTED]]
Sent: Monday, December 11, 2000 7:43 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Problem in ejbcreate and ejbPostcreate
hi
I developed some entity beans .
in which one field is a primary key , but in database
it is an auto increment field .
SO, what i did i wrote a trigger which update my id after each insert .
But in ejbpost create , after crating an entity bean with the id=0 ,
Getting new id from database and assinging the new id to the entiy bean
(CMP)
when i try to find out the bean with primary key(0) (by
findByPrimaryKey())
i am getting the exception ObjectNotFoundException.
Before assining the new primary Key (id)
how the primary key(id) is changing ??
Thanks
-Ritesh
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".