-->
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.  [ 1 post ] 
Author Message
 Post subject: UUIDs, user types, and Oracle
PostPosted: Tue Dec 14, 2010 9:38 am 
Newbie

Joined: Tue Dec 14, 2010 9:15 am
Posts: 1
Hi there,

I'm afraid this is something close to an FAQ; searching finds lots of material, but no good complete summary of what's the right thing do. So here we go:

We'd like to use application-defined UUIDs as primary keys, and would like them to be stored as strings in the database for readability (we're not concerned with compactness or speed for now).

In Hibernate 3.5, we used a custom UserType, written based on the many FAQs in the net. Using that user type, we managed to get the ID column be created as varchar(1), which didn't seem to bother HSQL. Adding "length=37" to the @Column annotation actually changes the length in HSQL (where it didn't matter), but apparently not in Oracle (where it does matter).

We now upgraded to Hibernate 3.6, where org.hibernate.type.UUIDCharType seemed to promise to do what we want. However, for HSQL I see this:

Code:
id varchar(255) not null


and, after annotating with length=37:

Code:
id varchar(37) not null


Shouldn't the length default (for the string representation of UUID) be applied automatically? And will Hibernate create the proper definitions for Oracle now? (can't test with Oracle right now).

Best regards, and sorry for the newbie-ish questions,

Julian


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

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.