-->
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.  [ 3 posts ] 
Author Message
 Post subject: mapping of generic class
PostPosted: Thu Oct 16, 2008 4:45 pm 
Newbie

Joined: Sun Sep 10, 2006 3:12 pm
Posts: 3
Hi!

Can anybody help me by telling me which is the best way to map a class like this:


Code:
public class PropertyImpl<T> implements Property<T>
{
   private String scope;
   private T value;
...
}


T can be Integer, Double, Boolean, Date, String or another mapped domain-type.

Objects of all types exist mixed in collections of the type List<Property<?>>.

Thank you for your help!

BTW: Yes, i know the thread at http://forum.hibernate.org/viewtopic.php?t=945113 , but it did not help me in any way...

Your's

Tiberius


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2008 5:26 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I guess it is hard to be truly generic. If you require the T to be Serializable you could map it with a custom UserType that serializes the value into a binary-type database column.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 17, 2008 3:12 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I just found that 'serializable' is a built-in Hibernate type (see http://www.hibernate.org/hib_docs/v3/re ... basictypes).
So if there is no need to build a custom UserType for this case.


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