-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Retrieving Identity Values
PostPosted: Fri Sep 26, 2003 10:41 pm 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
For some reason the identity column call back that retrieves key fields after insert is failing saying there is not "into". Here is the statement it is running:

2003/09/26 18:10:52:168 MDT [DEBUG] SessionFactoryImpl - -prepared statement get: values IDENTITY_VAL_LOCAL()

I would agree that this seems pretty terse. This is a DB2 database and I am using a 3.0 driver. If the driver supports it, could hibernate use getGeneratedKeys from the Statement interface?


Top
 Profile  
 
 Post subject: Using getGeneratedKeys
PostPosted: Mon Sep 29, 2003 7:32 pm 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
It looks like Hibernate could use the getGeneratedKeys support added with JDBC 3.0. I made a minimal change that required extending the Batcher and SessionFactoryImplementor interfaces and it seems to work OK. It was minimal because I did not add any support for configuration and assumed a JDBC 3.0 driver. Are there any plans to support getGeneratedKeys? On the surface, it looks reasonable and could be implemented in such a way as to not break existing implementors.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2003 7:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hibernate can not depend upon JDBC3 API, since we must support JDK1.2.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2003 7:47 pm 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
Would this be considered if it could work fine with a 1.2 JDK? The minimal implmentation I created did not break any existing code. However, I did not make the change I put in configurable (I hard coded to assume a 3.0 driver) because I was trying to see if it would work.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2003 7:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, I suppose you could need to implement this using reflection for the getGeneratedKeys() call. So far I'm not aware of any driver other than MySQL which supports this, but probably some SQL Server drivers support it (I never tried on JSQL).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 03, 2003 12:24 pm 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
Gavin,

I have this working using reflection and have tested with MySql/DB2/JDK 1.3/JDK1.4 but anonymous CVS at SourceForge is not working. I have tried many times over the last few days to create a patch but I can never get a connection.

At this point, I will take today's well-timed release and check it in to my CVS server. Then I could check it out and re-apply the changes and build the patches from there.

gavin wrote:
Well, I suppose you could need to implement this using reflection for the getGeneratedKeys() call. So far I'm not aware of any driver other than MySQL which supports this, but probably some SQL Server drivers support it (I never tried on JSQL).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 03, 2003 2:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Sounds good!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 04, 2003 2:10 am 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
I posted a patch through Jira. Let me know if there is anything else I can do. I didn't update the documentation but will provide a patch if it would be helpful.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.