[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5798) Is it really necessary to explicitly specifiy discriminatorValue for abstract classes?

Oleksandr Alesinskyy (JIRA) noreply at atlassian.com
Thu Dec 16 08:02:14 EST 2010


Is it really necessary to explicitly specifiy discriminatorValue for abstract classes?
--------------------------------------------------------------------------------------

                 Key: HHH-5798
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5798
             Project: Hibernate Core
          Issue Type: Improvement
          Components: entity-manager
    Affects Versions: 3.6.0
            Reporter: Oleksandr Alesinskyy


At the time being if the SINGLE_TABLE inheritance strategy is used, the discriminator type is set to char and some abstract classes in the hierarchy do not have an explicit discriminator value specified the following error occurs:
{quote}
Caused by: org.hibernate.AnnotationException: Using default @DiscriminatorValue for a discriminator of type CHAR is not safe
        at org.hibernate.cfg.annotations.EntityBinder.bindDiscriminatorValue(EntityBinder.java:373)
        at org.hibernate.cfg.annotations.EntityBinder.bindEntity(EntityBinder.java:200)
        at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:586)
        at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3977)
        at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3931)
        at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1368)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1477)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1096)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:685)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
{quote}

At the same time it is clear that no one row in the corresponding table may represent the abstract class, so it is absolutely safe to completely ignore abstract classes when decision is made which class is represented by a row. 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list