wood burning stoves 2.0*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Can I use Builder Pattern for creating Entities? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Can I use Builder Pattern for creating Entities?" Watch "Can I use Builder Pattern for creating Entities?" New topic
Author

Can I use Builder Pattern for creating Entities?

Nilessh Ganu
Ranch Hand

Joined: Dec 22, 2009
Posts: 100
In my assignment, one of the Entity should be created with data which would be (combination of partly data from 2 entities).
To combine the data and set few more Entity specific data, I am planning to use Builder pattern in SLSB.
Is this a common practice or should be avoided?

If allowed, can I use it like this:



So I end up instantiating the entity in the builder. Is that acceptable ?


Nilesh
SCJP SCWCD OCMJEA
Nilessh Ganu
Ranch Hand

Joined: Dec 22, 2009
Posts: 100
JPA entities are simply java objects until in "managed" state by EntityManager.
So do applying builder pattern for it, sounds okay ? A simple YES/NO would be appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I use Builder Pattern for creating Entities?
 
Similar Threads
Builder Pattern - Why does it looks like another Creational pattern
Value object Assembler can be used ?
How Do Foriegn Key Objects in JPA get Initialised?
NullPointer with EntityManager in Entity Bean
Instances of composite key classes (@IdClass annotation)