-->
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: Persisting aggregate objects?
PostPosted: Sun Apr 01, 2012 4:51 am 
Regular
Regular

Joined: Tue Apr 10, 2007 10:02 am
Posts: 56
A question about how to persist aggregate objects...

Take the situation below...
Code:
   public class Sub1 {
      private long Value1
      private long Value2
   }

   public class Sub2 extends Sub1 {
      private String Value3
   }

   public class Sub3 extends Sub1 {
      private double Value4
   }

   pubic class Main1 {
      private Sub1 Sub
   }



The 'Main1' class can have a value set into the 'Sub' field that is an instance of either 'Sub1', 'Sub2' or 'Sub3'. The only way I can see of persisting this is to have a separate table called 'sub' for the 'Sub1'/'Sub2'/'Sub3' instances and a one-to-one join from Main1 to sub.

Are there any other approaches?


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.