Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Value object Assembler can be used ?

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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" ?
 
Nilessh Ganu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ?
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's indeed the idea.
 
Nilessh Ganu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic