-->
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: How global is package-info.java?
PostPosted: Tue Mar 13, 2007 1:42 pm 
Newbie

Joined: Sun Jan 14, 2007 2:52 pm
Posts: 19
I am having trouble with defining global TypeDef annotations in package-info.java. I have defined three user types for Joda time. I have registered these in package-info.java as so:

Code:
@org.hibernate.annotations.TypeDefs({
  @org.hibernate.annotations.TypeDef(
    name="local_date_time",
    typeClass=JodaLocalDateTimeUserType.class
  ),
  @org.hibernate.annotations.TypeDef(
    name="local_date",
    typeClass=JodaLocalDateUserType.class
  ),
  @org.hibernate.annotations.TypeDef(
    name="local_time",
    typeClass=JodaLocalTimeUserType.class
  )
})


When I try and use a LocalDateTime in my domain objects it is only mapped correctly if I add another annotation @org.hibernate.annotations.Type(type="local_date_time") to each instance. Is this necessary? I was expecting to be able to define my TypeDef once and for it to become this default convertor for LocalDateTime. Is that possible? I am taking this from page 134 of Java Persistence with Hibernate.

Thank you,
Martin


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 6:57 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No unfortunately, there is no such mechanism in Hibernate (ie default the type for a given class).
Do you mind posting your type implementation in JIRA (in LGPL). No guaranty but it sounds interesting to autowire them in Hibernate Annotations

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 7:25 pm 
Newbie

Joined: Sun Jan 14, 2007 2:52 pm
Posts: 19
Sure I will post them tomorrow when I get in the office. They are tied to mysql at the moment, as it calls a Joda formatter with the mysql datetime format, but they can probably be made database independant by someone who understands hibernate dialects. As JSR310 is likely to be very similar to Joda having one in ready in anticipation could be quite cool. https://jsr-310.dev.java.net/

Edit: Sorry what do you mean by "as LGPL"? Just attach it and state it I am releasing it under LGPL?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 8:30 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
year, typically not having a header stating that your code is proprietary to ACME corp and for internal use only :-)

I'm aware of the JSR, I'll need to keep an eye on it.

Hum, using Dialect informations in type is far from trivial, this might need to wait for Hibernate 4 :-(

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 14, 2007 6:33 am 
Newbie

Joined: Sun Jan 14, 2007 2:52 pm
Posts: 19
Created http://opensource.atlassian.com/project ... se/ANN-582


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 08, 2007 12:56 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Change your footer or your account will be removed. No spam.

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


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.