[hibernate-issues] [Hibernate-JIRA] Updated: (ANN-698) Unbound property when default field access is used lead to unbound AnnotationException

Emmanuel Bernard (JIRA) noreply at atlassian.com
Mon Mar 3 22:37:33 EST 2008


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

Emmanuel Bernard updated ANN-698:
---------------------------------

    Summary: Unbound property when default field access is used lead to unbound AnnotationException  (was: unbound property when default field access is used lead to unbound AnnotationException)

> Unbound property when default field access is used lead to unbound AnnotationException
> --------------------------------------------------------------------------------------
>
>                 Key: ANN-698
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-698
>             Project: Hibernate Annotations
>          Issue Type: Bug
>    Affects Versions: 3.3.0.ga
>         Environment: hibernate3.jar: 3.2.5.ga
> hibernate-annotations.jar: 3.3.0.GA
> hibernate-commons-annotations.jar: 3.0.0.GA
> hibernate-validator.jar: 3.0.0.GA
> MySQL
>            Reporter: Sebastian Baltes
>             Fix For: 3.3.1
>
>         Attachments: log.txt
>
>
> Transient fields are not ignored in Hibernate. I got an "Property has an unbound type" exception and found no workaround.
> Entity:
> import javax.persistence.Entity;
> import javax.persistence.Id;
> import javax.persistence.Transient;
> @Entity
> public class Dummy<K> {
>   
>   @Id
>   private Long id;
>   
>   @Transient
>   transient private K dummyField;
>   public Long getId() {
>     return id;
>   }
>   public void setId(Long id) {
>     this.id = id;
>   }
>   public K getDummyField() {
>     return dummyField;
>   }
>   public void setDummyField(K dummyField) {
>     this.dummyField = dummyField;
>   }
> }
> Test Code:
>       EntityManager em = EntityManagerSingleton.get();
>       EntityTransaction tx = em.getTransaction();
>       tx.begin();
>       Dummy a = new Dummy();
>       em.persist(a);
>       tx.commit();
> Exception:
> java.lang.ExceptionInInitializerError
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 	at junit.framework.TestSuite.createTest(TestSuite.java:54)
> 	at junit.framework.TestSuite.addTestMethod(TestSuite.java:280)
> 	at junit.framework.TestSuite.<init>(TestSuite.java:140)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
> 	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: javax.persistence.PersistenceException: org.hibernate.AnnotationException: Property de.neise.gena.model.file.Dummy.dummyField has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:258)
> 	at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
> 	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
> 	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
> 	at de.neise.gena.model.testbase.BaseTest.<clinit>(BaseTest.java:19)
> 	... 13 more
> Caused by: org.hibernate.AnnotationException: Property de.neise.gena.model.file.Dummy.dummyField has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type
> 	at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:993)
> 	at org.hibernate.cfg.AnnotationBinder.getElementsToProcess(AnnotationBinder.java:833)
> 	at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:645)
> 	at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:498)
> 	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:277)
> 	at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
> 	at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
> 	at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186)
> 	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246)
> 	... 17 more

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