JavaReflectionManager fails with generic types like MyGenericType<Object[]>
---------------------------------------------------------------------------
Key: ANN-612
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-612
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: I'm using the latest versions:
Hibernate 3.2.4.ga
Hibernate Entity Manager 3.3.1.ga
Hibernate Commons Annotations 3.0.0.ga
Hibernate Validator 3.0.0.ga
JBoss Archive Browsing 2.0.2.alpha
Reporter: Aleksei Valikov
Attachments: C.java
I have a property of generic type with an array parameter like this one:
public static class J<T> {}
private J<Object[]> e;
@Transient
public J<Object[]> getE() {
return e;
}
public void setE(J<Object[]> e) {
this.e = e;
}
When starting the entity manager, I get the following exception:
javax.persistence.PersistenceException: java.lang.IllegalArgumentException: No
PropertyTypeExtractor available for type void
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:83)
at
org.jvnet.hyperjaxb3.ejb.test.AbstractEntityManagerTest.createEntityManagerFactory(AbstractEntityManagerTest.java:85)
at
org.jvnet.hyperjaxb3.ejb.test.AbstractEntityManagerTest.setUp(AbstractEntityManagerTest.java:44)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
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: java.lang.IllegalArgumentException: No PropertyTypeExtractor available for type
void
at
org.hibernate.annotations.common.reflection.java.JavaReflectionManager.toXType(JavaReflectionManager.java:164)
at
org.hibernate.annotations.common.reflection.java.JavaXProperty.create(JavaXProperty.java:20)
at
org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getXProperty(JavaReflectionManager.java:117)
at
org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredMethodProperties(JavaXClass.java:91)
at
org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredProperties(JavaXClass.java:106)
at
org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredProperties(JavaXClass.java:98)
at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:984)
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
The following property makes no problem:
private J<Object> f;
@Transient
public J<Object> getF() {
return f;
}
public void setF(J<Object> f) {
this.f = f;
}
So I believe it's the arrayd type which is problematic.
From the stack trace, I believe the problem is with
hibernate-commons-annotations.
I also attach the class that reproduces the problem.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira