Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: guid generator in hibernate3
PostPosted: Wed Feb 09, 2005 5:09 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 4:54 pm
Posts: 32
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

hibernate3 has a generator class "guid", which the documentation says " uses a database-generated GUID string on MS SQL Server and MySQL". i am looking at some key generation schemes for oracle, and i've discovered that oracle has a sys_guid() function. is this also supported in the guid generator?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 5:40 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 4:54 pm
Posts: 32
okay, i looked it up (which i should have done before). answer is no, the Oracle9 dialect does not implement getSelectGUIDString(). i think it could...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 5:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Try extending the dialect, if this works submit a patch, additions to the dialects are always welcome.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 6:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I'd like to support this. But I want you to check that it works first.

sys_guid() returns an Oracle RAW value, which we want to convert to a String using ResultSet.getString()

Can you check that the JDBC driver is cool with that conversion?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 6:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
OK, I'm going with this:

Code:
   public String getSelectGUIDString() {
      return "select rawtohex(sys_guid()) from dual";
   }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 6:35 pm 
Beginner
Beginner

Joined: Fri Oct 15, 2004 4:54 pm
Posts: 32
thanks. i'll add it in and give it a try myself. i really appreciate this...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 12, 2005 7:19 am 
Beginner
Beginner

Joined: Fri Oct 15, 2004 4:54 pm
Posts: 32
you could guess, but this works just fine. i downloaded beta 5 last night and ran it.

thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 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.