• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Domain Model question

 
Sergio Navarro Garza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!

I'm working in the second part of the cert (assignment) and I'm having doubts regarding domain model design.

In my design I use JPA entities as my persistence layer, which I could also use as domain model because is semantically equal to the required model but would it be a good idea to reuse them or should I generate a new set of POJOs for the model domain?

I think that I should be able to maintain my JPA-implemented model under DB changes by playing with the ORM mapping, but my fear is that the absence of a POJO domain model is evaluated as not academic. On the other hand, two separate set of classes with the same semantic could be also evaluted as clutter.

What is your opinion??

Thanks!!
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

The domain model objects are entities so if you use JPA those classes with be annotated with @Entities.

Where to put these entities? In the persistence layer. Normally there will be business layer that will communicate with the persistence layer to do what is needed. Once in the business layer, those so-called entities are treated as POJO which then passed back to the presentation layer.

Therefore, 1 set of entities and do all those ORM mapping and JPA related operations in them.
 
Sergio Navarro Garza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Understood, thank you for your concise answer ;)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic