File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I use Builder Pattern for creating Entities?

 
Nilessh Ganu
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Nilessh Ganu
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic