• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

What is the use of @forcediscriminator ?

 
Ranch Hand
Posts: 66
MyEclipse IDE Firefox Browser 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
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
MyEclipse IDE Firefox Browser 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
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
MyEclipse IDE Firefox Browser 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
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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.
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!