-->
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.  [ 4 posts ] 
Author Message
 Post subject: UserType to persist ENUM as String-problems with DB mapping
PostPosted: Sat May 22, 2004 3:54 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:43 am
Posts: 35
Hi
Based on article "UserType to persist ENUM as String" I've created version that persist ENUM to intiger. I've changed all references from String to integer (or Integer because part of classes use Map).
But I do not why my field are always maped to "varchar(xx) binary" (under MtSQL using schemeexport tool) but I think this field should mapped to integer. To be honest original version also mapped to "varchar(xx) binary" instead "varchar(xx).

But I do not know what is wrong.
All sources are available here: michal.szymanski.free.fr/tmp

Any sugestions ?

Michal


Top
 Profile  
 
 Post subject: By the way..
PostPosted: Sat May 22, 2004 3:59 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:43 am
Posts: 35
I do not understand why PersistentEnum is deprecated? New suggested enum solution is too complex for typical situation!

Michal Szymanski


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 22, 2004 4:09 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
PersistentEnum is a keyword in JDK 1.5 and you shouldn't use Hibernate APIs in your persistent classes anyway. It was a bad idea in the first place.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 22, 2004 6:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
It should be fairly trivial to have all your enums implement a common interface and write a UserType which persists all of them. This only adds an additional type="yyy" declaration to all the enum properties, and we think thats bearable.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.