This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

What is the use of @forcediscriminator ?  RSS feed

 
Ranch Hand
Posts: 66
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.
 
Sheriff
Posts: 11604
178
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: 66
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: 11604
178
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: 66
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: 11604
178
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.
 
Police line, do not cross. Well, this tiny ad can go through:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!