Hi,


If I understand right, u have created an entity bean with id=0. Lets say the bean has 
two members id = 0 AND name = 'John Matthew'.

Once u fire a create, this creates a database record. However, coz of the trigger the 
record is updated with id = some value, say id = 3. Now there's no record in the 
database with id=0. Now if u fire a findbyprimarykey with id = 0, there's no record 
matching that value!!

Now if u try to invoke a method on the same bean reference, u wud get the 
ObjectNotFoundException coz, the container will try to activate it (in short fire a 
query on the table with the where clause something like id = 0 which won't return any 
records!!).

I suggest, define a method on the bean to retreive the value that was updated by the 
trigger and use that value to fire a findbyprimarykey.

Best Regards,

dev

------------- Original Message --------------
Ritesh <[EMAIL PROTECTED]> wrote:
To:"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
From:Ritesh <[EMAIL PROTECTED]>
Date:Mon, 11 Dec 2000 13:12:59 +0530
CC:"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>, 
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject:[EJB-Developer] 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





-------------------------- eGroups Sponsor -------------------------~-~>
eLerts
It's Easy. It's Fun. Best of All, it's Free!
http://click.egroups.com/1/9699/0/_/605598/_/976520592/
---------------------------------------------------------------------_->

Community email addresses:
  Post message: [EMAIL PROTECTED]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://www.egroups.com/group/EJB-Developer



_____________________________________________________
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com

Participate in crazy auctions at http://auctions.rediff.com/auctions/



----
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".

Reply via email to