• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default DiscriminatorColumn - Single table per class hierarchy

 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using @DiscriminatorColumn for specifying the discriminator column name and value for the "single table per class hierarchy strategy".

Some articles saying that DiscriminatorColumn's default column name is "DTYPE". Does it mean that @DiscriminatorColumn annotation is optional for this strategy? If it is, what will the 'type' of the default discriminator?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Treimin,

(at least with Hibernate as persistence provider) the default name for the discriminator column is really "DTYPE" and the default type of the discriminator values is DiscriminatorType.STRING. The value of the discriminator field defaults to the corresponding entity name for each row.

Marco
 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marco Ehrentreich wrote:Hi Treimin,

(at least with Hibernate as persistence provider) the default name for the discriminator column is really "DTYPE" and the default type of the discriminator values is DiscriminatorType.STRING. The value of the discriminator field defaults to the corresponding entity name for each row.

Marco


Many Thanks Marco,

But I don't know about Hibernate which you mentioned. The only Hibernate I know is Start-->Turn Off-->Hibernate

Thanks again.
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome ;-)

If you're using the Java Persistence API (JPA) which belongs to EJB 3.0 then you don't really have to know very much about Hibernate. Hibernate is just one possible implementation for the JPA specification. Another more or less exchangeable implementation would be TopLink JPA.

I've looked this up for you and TopLink uses the same default name/value/type for the discriminators. So I guess other possible JPA implementations will have the same defaults as said in my last post.

Marco
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic