• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA Discriminator

 
MarioAixel Rodriguez Jaen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question to those more familiar with JPA.

In my assignment, I need to map several Entities that share common properties. I was intending to implement a inheritance by using JPA Entities with a discriminator. This will allow me to have a strategy of having a table per concrete class strategy and having a BaseEntity for my classes.

However, I read on the j2ee5 tutorial the following:

Support for this strategy is optional, and may not be supported by all Java Persistence API providers. The default Java Persistence API provider in the Application Server does not support this strategy.


http://download.oracle.com/javaee/5/tutorial/doc/bnbqa.html#bnbqn

Is the use of the discriminator strategy something common in JPA? or am I risking too much with this approach?

Thanks,
Mario

 
MarioAixel Rodriguez Jaen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the end I´m going to put all the different classes in one single table (the default behavior). It will be faster and easier to maintain due to the fact that most of the objects that I wanted to represent in tables will share the attributes.
 
Vijaykumar Dixit
Ranch Hand
Posts: 32
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not yet used table per concrete class strategy. But I know for sure Table per Class hierarchy works well and has been implemented by many JPA providers. I have used it.

So it would be a safe bet if the design permits.
 
san kumar parihar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mario - Would hierarchy mapping details go to textual notes in assignment solution? For sure this wouldn't be in the class diagram and I am wondering which section this belongs. I had totally ignored this until I saw this query. Thanks for that...
 
Vijaykumar Dixit
Ranch Hand
Posts: 32
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys who have passed SCEA, can anyone respond please?

Is database design / data model mandatory in assignment? Is it not enough to show JPA entities?
 
MarioAixel Rodriguez Jaen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I think it is a case of over designing a little bit.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic