-->
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.  [ 6 posts ] 
Author Message
 Post subject: Does Hibernate have Column Conversion like OJB?
PostPosted: Mon Dec 08, 2003 7:31 pm 
Beginner
Beginner

Joined: Wed Oct 08, 2003 4:22 pm
Posts: 29
We've decided to move our platform from OJB to Hibernate.

One very useful feature of OJB we made extensive use of was the conversion capability. It enabled you to do things like persist a collection to a clob or blob column.

Example from OJB mapping:
Code:
      <field-descriptor
         name="taskStatus"
         column="TaskStatus"
         jdbc-type="VARCHAR"     conversion="com.teradata.tap.system.scheduler.List2StringFieldConversion"    />


How would I accomplish this in Hibernate? If not built-in, what would be the recommended way we could build it into our Hibernate wrapper classes (i.e. in preStore or something like that)

TIA,

Alex


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 7:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hibernate has a much more sophisticated facility for this.

check out UserType and CompositeUserType


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 08, 2003 9:07 pm 
Beginner
Beginner

Joined: Wed Oct 08, 2003 4:22 pm
Posts: 29
Thanks, looks very clean - any repositories of common UserType implementations? (i.e. OJB bundles a number of them)


Top
 Profile  
 
 Post subject: Column conversion delegate Re: Column Conversion like in OJB
PostPosted: Tue Dec 23, 2003 2:52 pm 
Newbie

Joined: Tue Dec 23, 2003 2:29 pm
Posts: 2
Re: Does Hibernate have Column Conversion like OJB?

In contrast to OJB using Hibernate's PersistentEnum/UserType introduces unwanted dependency on Hibernate-specific classes. As result my business classes that require custom mapping will depend on Hibernate classes (something that "transparent persistence" OR mapping system should avoid).

Does Hibernate allow to delegate column conversion logic into separate class?


gavin wrote:
swordsman wrote:
We've decided to move our platform from OJB to Hibernate.

One very useful feature of OJB we made extensive use of was the conversion capability. It enabled you to do things like persist a collection to a clob or blob column.

Example from OJB mapping:
Code:
      <field-descriptor
         name="taskStatus"
         column="TaskStatus"
         jdbc-type="VARCHAR"     conversion="com.teradata.tap.system.scheduler.List2StringFieldConversion"    />


How would I accomplish this in Hibernate? If not built-in, what would be the recommended way we could build it into our Hibernate wrapper classes (i.e. in preStore or something like that)

Hibernate has a much more sophisticated facility for this. Check out UserType and CompositeUserType




Thanks a lot!
Andy Malakov


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 2:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Quote:
In contrast to OJB using Hibernate's PersistentEnum/UserType introduces unwanted dependency on Hibernate-specific classes.


Please read how UserType works. This is just wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 3:30 pm 
Newbie

Joined: Tue Dec 23, 2003 2:29 pm
Posts: 2
gloeglm wrote:
Quote:
In contrast to OJB using Hibernate's PersistentEnum/UserType introduces unwanted dependency on Hibernate-specific classes.


Please read how UserType works. This is just wrong.


Thank you very much.

Now I see that my statement only applicable to PersistentEnum.

UserType is a bit heavy for one-field data mappings but will do the job.

All the Best,
Andy


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