I'm back on version 1.4 and will upgrade immediately to 1.5. If that version does not have the correct getLastInsertIdentity, then I will have to look into implementing it elsewhere, perhaps by extending PlatformMsSQLServerImpl with a custom getLastInsertIdentity method that simply returns "SELECT SCOPE_IDENTITY() AS newID".
Thanks again for your help.
From: Armin Waibel <[EMAIL PROTECTED]> Reply-To: "OJB Users List" <[EMAIL PROTECTED]> To: OJB Users List <[EMAIL PROTECTED]> Subject: Re: Primary Key from Insert Date: Wed, 17 Mar 2004 15:49:44 +0100
Hi Glenn,
why don't you use a identity based sequence manager implementation?
http://db.apache.org/ojb/sequencemanager.html#nativeSequenceManager
(seems that one part of this section was "corrupted" by Maven, with "ant htmldoc" you can generate the local documentation)
or your persistent capable objects can implement PersistenceBrokerAware interface and you assign the PK by hand in the afterInsert method (obtain connection from PB instance and perform sql query by your own).
regards, Armin
Glenn Barnard wrote:
I'm using SQL Server 2000 and need to get the primary key returned in the data model after an insert. My research shows that the query "SELECT SCOPE_IDENTITY() AS newID" needs to be executed. What do I need to do to get OJB to automatically populate the PK field in the data model it returns?
_________________________________________________________________
Get tax tips, tools and access to IRS forms – all in one place at MSN Money! http://moneycentral.msn.com/tax/home.asp
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Free up your inbox with MSN Hotmail Extra Storage. Multiple plans available. http://click.atdmt.com/AVE/go/onm00200362ave/direct/01/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]