-->
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.  [ 1 post ] 
Author Message
 Post subject: Multi-Type Field
PostPosted: Sun Mar 20, 2011 10:18 pm 
Newbie

Joined: Sat Mar 29, 2008 4:49 pm
Posts: 19
Is there an easy way in Hibernate to support fields whose type is Object but whose in-application values will be one of the boxed primitive types (e.g. Integer, Float, etc.), Date or String? In other words, can I have the following class persisted somehow:

Code:
public class Field {
   @Id
   Long id;
   Object value;
}

In table format, I figured it would be something like:

Code:
CREATE TABLE FIELD (id bigint, fieldlong bigint, fieldint integer, fieldts timestamp, fieldfloat double precision, fieldstr varchar2);


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.