-->
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.  [ 4 posts ] 
Author Message
 Post subject: Value Object versus Value Type versus Component
PostPosted: Thu Oct 25, 2007 7:27 pm 
Newbie

Joined: Fri Dec 02, 2005 2:48 pm
Posts: 13
a) Is there any difference between 'Value Object' (fowler/ddd) and 'Value Type' (Hibernate)?

b) A 'component' (composition, not to architecture-level components) has the same meaning as 'value type'?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 10:09 pm 
Newbie

Joined: Thu Oct 25, 2007 3:37 pm
Posts: 17
I think value object, in common usage, means any java object that is being used primarily as a data carrier. in this sense, all of the pojo's that you use with hibernate would be considered value objects -- at least that's how i think of it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 11:10 pm 
Newbie

Joined: Fri Dec 02, 2005 2:48 pm
Posts: 13
tomfrosty wrote:
I think value object, in common usage, means any java object that is being used primarily as a data carrier. in this sense, all of the pojo's that you use with hibernate would be considered value objects -- at least that's how i think of it.


I'm not talking about Data Transfer Object (Core J2EE Design Patterns). See the Patterns of Enterprise Application Architecture book.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 11:50 pm 
Newbie

Joined: Fri Dec 02, 2005 2:48 pm
Posts: 13
Java Persistence with Hibernate book says:
Quote:
The lifespan of a value type instance is [b]bounded by the lifespan of the owning entity instance. A value type doesn’t support shared references: If two users live in the same apartment, they each have a reference to their own homeAddress instance. The most obvious value types are classes like Strings and Integers, but all JDK classes are considered value types.


It's strange... String suports shared references and it's not bounded by the lifespan of the entity instance! Is String really a Value Type?

On the other hand, a Value Object suports shared references when it's immutable (like String)!

Is there any similarity between Value Object and Value Type?


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