Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the use of @forcediscriminator ?

 
Sreyan Chakravarty
Ranch Hand
Posts: 65
Firefox Browser MyEclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I googled a lot to no avail. What is the use of the annotation called @forcediscriminator ? Is it used to force the discriminator in the WHERE clause ? Why doesn't a JPA provider use the discriminator in the WHERE clause by default ? The existence of such an annotation seems kinda redundant to me.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this article describes pretty well why you need to use the @ForceDiscriminator annotation.
 
Sreyan Chakravarty
Ranch Hand
Posts: 65
Firefox Browser MyEclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:I think this article describes pretty well why you need to use the @ForceDiscriminator annotation.


Is it part of JPA or Hibernate specifically ?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sreyan Chakravarty wrote:Is it part of JPA or Hibernate specifically ?

If you have a look at the JPA package sumary, you'll see no mention of ForceDiscriminator so it's Hbernate specific.
 
Sreyan Chakravarty
Ranch Hand
Posts: 65
Firefox Browser MyEclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Sreyan Chakravarty wrote:Is it part of JPA or Hibernate specifically ?

If you have a look at the JPA package sumary, you'll see no mention of ForceDiscriminator so it's Hbernate specific.


So just correct me if I am wrong. @forcediscriminator just adds the discriminator to the WHERE clause right ?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sreyan Chakravarty wrote:@forcediscriminator just adds the discriminator to the WHERE clause right ?

I have never used it, so I have no clue. But according to Hibernate docs @ForceDiscriminator is deprecated and you should use @DiscriminatorOptions instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic