-----Original Message-----
From: Brett Porter [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 6:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] KeyGen: PK of Object just createdLast time I used it, the identity is not set until you commit the transaction, which is an almighty pain :)
- Brett
-----Original Message-----
From: Ayush Gupta [mailto:[EMAIL PROTECTED]]
Sent: Friday, 15 March 2002 1:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] KeyGen: PK of Object just created
Margaret,
The key is generated inside the create method not by the client which calls
create. Castor generates the key using @@identity at the database for SQL
Server.
http://castor.exolab.org/key-generator.html#IDENTITY-key-generatorI did try printing the primary key but it does not seem to work
db.create(newProduct);
System.out.println("The PK Returned is " +
((Integer)db.getIdentity(newProduct)).intValue() );- Ayush
-----Original Message-----
From: Martin, Margaret [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 5:41 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] KeyGen: PK of Object just created
Ayush,
Isn't the value available in the object you just created? I haven't used key
generators yet, but that would seem logical to me...Margaret Martin
-----Original Message-----
From: Ayush Gupta [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 14, 2002 5:04 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] KeyGen: PK of Object just created
This might be a trivial question but since create(newProduct) does not
return anything, how do I know the primary key of the row which was just
inserted into Product table?I have a class Product, having productId (IDENTITY Keygen) as its identity.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
Title: RE: [castor-dev] KeyGen: PK of Object just created
So if
my architecture is EJBs and my container handles all transactions then I
basically can't get the identity value back on a create().
Is
that assumption correct?
Ayush
