-->
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: Automatic user type chooser
PostPosted: Fri Apr 08, 2005 1:00 am 
Beginner
Beginner

Joined: Thu Aug 26, 2004 5:53 am
Posts: 37
Hibernate currencly can automatically choose the hibernate type to use when a the mapping doesn't specify the type property.

Can this system be extended to support user types ?

For example, say I want to use Joda-Time DateTime and YearMonthDay classes for my persistent properties.

Code:
class Booking {
 
   private org.joda.time.DateTime dts;
   private org.joda.time.YearMonthDay checkinDate;

   // getters and setters
}


in my mapping I would like to be able to do :

Code:
<typedef
  class='hidahibernate.DateTimeUserType'
  name='jodaDateTime'
/>
<typedef
  class="hidahibernate.YearMonthDayUserType'
  name='jodaYearMonthDay'
/>

<class name='Booking'>
  <property name='dts'/>
  <property name='checkinDate'/>
</class>


Then some how specify a strategy to resolve property classes org.joda.time.YearMonthDay and org.joda.time.DateTime to user types named 'jodaYearMonthDay' and 'jodaDateTime'.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 1:03 am 
Beginner
Beginner

Joined: Thu Aug 26, 2004 5:53 am
Posts: 37
One idea may be to add a new attribute to the <typedef> element "defaultForReturnedClass" since the USerType implementation has a public Class returnedClass() method, the <typedef> that is flagged as default could be chosen automatically for these properties.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 20, 2005 10:28 pm 
Beginner
Beginner

Joined: Thu Aug 26, 2004 5:53 am
Posts: 37
anyone have anything to say on this ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 22, 2005 10:37 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
how about providing a patch :-)

_________________
Emmanuel


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.