Title: Message
Can you use UUID's?  Then your problem would be solved....  see the "uuid.hex" generator in the docs...
 
Les
-----Original Message-----
From: Thierry Hanot [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 21, 2003 10:34 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [Hibernate] newbies question about ids

I was thinking of using a new IdentityGenerator , but it's not enough because i have the id only after the insert .
The problem is the following , when you need to access to the DB before the insert for getting an id , it's ok , you have infos on the table in the IdGenerator , but
when you need to retreive Id after the insert , you only have one generic request based on the dialect not on the table.
I will have a look on the persisters implementation , i think now that the only way for me to have what i want.
 
 
Thanks anyway .
 
Thierry
 
     
 
-----Original Message-----
From: Mark Woon [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 8:37 PM
To: Thierry Hanot
Subject: Re: [Hibernate] newbies question about ids

Thierry Hanot wrote:
First in the hbm file i ve tryied to set the generator on identity, it's not working because the dialect Oracle 9i has no generic request for retreive the last inserted id.
 
And in fact there is no generic request for retreiving the id of the last inserted row.( of course the name of the id column differ on each table :/) 
So my the only way for me is to select the value from the ID column on each insert or to replace the insert request by  something like this "INSERT INTO TEST (VAL) " + "VALUES (?) RETURNING ID INTO ?". But i need help doing this correctly. I was thinking first to use my Dialect but like i need to retrieve the Table name , the column id name to build the request for getIdentitySelectString . So i'm stuck.
 I don't see any simple solution to solve it. Is anybody can help me ?

I believe you can implement your own net.sf.hibernate.id.IdentifierGenerator to do exactly what you want.  See http://hibernate.bluemars.net/hib_docs/reference/html_single/#or-mapping-s1-4--generator.


-Mark

Reply via email to