[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-5004) Specifying entity access type at class level and then redundantly again on id field or getId() causes EntityManagerFactory configuration failure

Hardy Ferentschik (JIRA) noreply at atlassian.com
Thu May 27 14:47:54 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hardy Ferentschik resolved HHH-5004.
------------------------------------

    Resolution: Fixed

Fixed issue in {{PropertyContainer}}.

> Specifying entity access type at class level and then redundantly again on id field or getId() causes EntityManagerFactory configuration failure
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5004
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5004
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations, entity-manager
>    Affects Versions: 3.5.0-CR-2, 3.5.1
>         Environment: I'm developing on Fedora 12 64bit version. java version: Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
>            Reporter: Jesse Hutton
>            Assignee: Hardy Ferentschik
>            Priority: Minor
>         Attachments: testHibernate.tar.gz, testHibernate2.tar.gz
>
>
> If you annotation an entity class with @Access and either AccessType.FIELD or AccessType.PROPERTY and then repeat the same respective access annotation for identifier of the class, hibernate will not be able to find the identifier. An example stack trace is:
> javax.persistence.PersistenceException: [PersistenceUnit: testhibernate] Unable to configure EntityManagerFactory
> ...
> Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.mycompany.testhibernate.Foo
> ...
> To annotate a class as such is clearly redundant, but it doesn't seem like it should really cause this error. I happened to have discovered it while experimenting with different access type options in JPA 2 using EclipseLink, forgetting to remove an access type annotation to the getId() method of my entity, and then eventually switching JPA providers to Hibernate. Under EclipseLink, there was no problem with the redundant annotations.
> Attached is a sample test app illustrating the problem. It has access PROPERTY specified, but the error occurs with FIELD just the same.

-- 
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