[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4358) Having to use @ForceDiscriminator kind of breaks JPA compatibility

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Dec 20 11:24:22 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44646#comment-44646 ] 

Steve Ebersole commented on HHH-4358:
-------------------------------------

Not sure where I "made fun of" you.  And I dont think you should be talking about tone in comments; just look at yours on this issue.  You are the only one getting worked up.

Sure, Mike also speaks from the perspective of the particular JPA impl he works on :)  Hibernate does not need the discriminator value here (really if you step back and think about it, the discriminator is completely unnecessary) so it does nothing with it.  What Mike refers to is the awesomely worded passage
{quote}
For the SINGLE_TABLE mapping strategy, and typically also for the JOINED strategy, the persistence
provider will use a type discriminator column. The DiscriminatorColumn annotation is used to
define the discriminator column for the SINGLE_TABLE and JOINED inheritance mapping strategies.
{quote}

That is the only time DiscriminatorColumn is discussed in conjunction with JOINED.  The entire section devoted to the JOINED strategy (2.12.2) does not mention use of DiscriminatorColumn once.  Whereas the discussion of DiscriminatorColumn in regards to SINGLE_TABLE comes up in the second sentence of its section (2.12.1).  Not to mention that the passage itself goes out of its way to differentiate DiscriminatorColumn as used SINGLE_TABLE versus as used with JOINED.  I mean to me, as a person whose primary language is English, the phrase "typically also for the JOINED strategy" says that not all providers use a DiscriminatorColumn with JOINED and that it is not mandated that they do.  Not sure what "laws of physics" Mike is referring to, but the laws of physics I always learned were never that obtuse nor wishy-washy.  Yeah, in retrospect, for the sake of portability I can see how Hibernate still writing the discriminator value to the database is useful.  But I am sure Mike and his crew often think deeply about portability to Hibernate as well ;)

Open a RFE if you wish.

> Having to use @ForceDiscriminator kind of breaks JPA compatibility
> ------------------------------------------------------------------
>
>                 Key: HHH-4358
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4358
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: annotations
>         Environment: JPA
>            Reporter: Steve Ebersole
>            Assignee: Steve Ebersole
>              Labels: jpa2
>             Fix For: 4.0.1
>
>
> According to
> http://opensource.atlassian.com/projects/hibernate/browse/ANN-36
> @ForceDiscriminator was created as a quick workaround to a problem.
> Yes, it solves the problem, but it creates a new problem:
> the source code which previously had only JPA annotations, now need to be annotated by a Hibernate annotation,
> causing that the the source code is now unable to use just any JPA provider.
> Major portability issue!
> Everyone who likes Open Source, hates Lock-Ins!
> My proposal: change the default to a more sane force=true, so that @ForceDiscriminator will not be needed for general JPA projects.
> (And create a @DisableDiscriminator Hibernate annotation, for those who like to brake their code).
> If changing default behavior is risky, don't fix this on older versions, but lets change this from 3.5.0-Beta2.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list