aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Value object Assembler can be used ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Value object Assembler can be used ?" Watch "Value object Assembler can be used ?" New topic
Author

Value object Assembler can be used ?

Nilessh Ganu
Ranch Hand

Joined: Dec 22, 2009
Posts: 100
Hi All,

In my assignment, there is one @Entity(EntityA). But I require part of it's data to be persisted as a separate @Entity(EntityB).
This is the case as I can't simply use EntityA further in the flow.

Can I use value object assembler pattern to depict this with "EntityB" being considered in place of "value object" ?

Nilesh
SCJP SCWCD OCMJEA
Nilessh Ganu
Ranch Hand

Joined: Dec 22, 2009
Posts: 100
Nilessh Ganu wrote:Hi All,

In my assignment, there is one @Entity(EntityA). But I require part of it's data to be persisted as a separate @Entity(EntityB).
This is the case as I can't simply use EntityA further in the flow.

Can I use value object assembler pattern to depict this with "EntityB" being considered in place of "value object" ?


Can I expect some comments ?
Arnold Reuser
Ranch Hand

Joined: Nov 20, 2003
Posts: 196
The value object assembler - aka Tranfer Object Assembler - is about the composition of transfer objects e.g. to define the Presentation Model used by the Presentation Tier.
The Transfer Object Assembler therefore does not help you out on this.
Even if you are refering to the Composite Entity pattern? Composite Entity aggregates a set of related Business Objects, such as Order and LineItems, into coarse-grained entity bean implementation.
The Composite Entity pattern will therefore also not help you out on this.
So currently I am not sure what you are trying to accomplish based on the given patterns.

Hopefully the following will help you out :
If the data you would like to persist, as part of the other entity, is a value object and not an entity in itself.
It could be the case that you are simply looking for the JPA embeddable type.
Nilessh Ganu
Ranch Hand

Joined: Dec 22, 2009
Posts: 100
Arnold Reuser wrote:
Hopefully the following will help you out :
If the data you would like to persist, as part of the other entity, is a value object and not an entity in itself.
It could be the case that you are simply looking for the JPA embeddable type.


Thanks Arnold for the response. I hope you mean the following:



Say I need to persist only propertyA and propertyB from Entity, I will create value object like:



And embed it in target EntityB class:



If this is correct, should this be depicted as following in class diagram:

EntityA --> value object assembler --> valueObjectEntityA --> EntityB

The reason I am not very sure to use value object assembler is the fact that value objects are mainly used to transfer data across tiers to avoid multiple remote calls.
Arnold Reuser
Ranch Hand

Joined: Nov 20, 2003
Posts: 196
That's indeed the idea.
Nilessh Ganu
Ranch Hand

Joined: Dec 22, 2009
Posts: 100
Arnold Reuser wrote:That's indeed the idea.


Thanks again.

In case you missed the last comment "The reason I am not very sure to use value object assembler is the fact that value objects are mainly used to transfer data across tiers to avoid multiple remote calls."

So the intent of the value object assembler class here would be to combine few fields from different entities.
Arnold Reuser
Ranch Hand

Joined: Nov 20, 2003
Posts: 196
Actually both the Value Object Assembler and Composite Entity pattern are not applicable to your situation. See my first post in this thread for more detail on this.
So your comment

The reason I am not very sure to use value object assembler is the fact that value objects are mainly used to transfer data across tiers to avoid multiple remote calls.


Is, from my point of view, correct.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Value object Assembler can be used ?