-->
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: Hibernate support for value semantics.
PostPosted: Tue Dec 01, 2009 8:43 am 
Newbie

Joined: Tue Dec 01, 2009 7:15 am
Posts: 1
Perhaps I'm missing something (my experience with hibernate has not been extensive) but is the support for value semantics quite shallow in Hibernate?

There is support for simple nested values (using dependent objects) and some support for collections of values (but only only to one level).

I'm working with an existing domain model where there is only a single entity but a number of associated value objects.

For example,
Code:
public class EntityClass {
   private String id;
   private String description;
   private List<ValueA> as;

   // ... getters & setters, etc.
}

public class ValueA {
   private String name;
   private List<ValueB> bs;

  // ... getters & setters, etc.
}

public class ValueB {
   private int amount;
   private int size;

  // ... getters & setters, etc.
}

(Note that only EntityClass has an ID.)

I don't think it is possible to persist this domain model unaltered using Hibernate? Nested collections of dependent objects are not supported. Adding IDs to either of the value classes fundamentally changes the (value) semantics of the domain model and introduces complexity elsewhere (entity life-cycle management).

I'm looking at using "inverse='true'" type collection properties and writing some wrapper Java clases to support this domain model but I'm wondering whether I'm overlooking something?

Any comments, general or specific, would be appreciated.


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.