[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4275) Method in entity with return type of ArrayList<Object[]> causes failure to build session factory
Ivan Prisiazhnyy (JIRA)
noreply at atlassian.com
Fri Jul 9 03:24:14 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37683#action_37683 ]
Ivan Prisiazhnyy commented on HHH-4275:
---------------------------------------
The same error goes in Hibernate Distribution 3.5.3-Final when there is a FIELD in the mapping class containing Array of Collection generic interfaces. See following code:
private Collection<Thing>[][] levels;
If you change generic collection to extender interface of it or use just a Collection, hibernate goes fine.
The following code works:
private Collection[][] levels;
private CollectionOfThing[][] levels;
private List<Thing>[][] levels;
> Method in entity with return type of ArrayList<Object[]> causes failure to build session factory
> ------------------------------------------------------------------------------------------------
>
> Key: HHH-4275
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4275
> Project: Hibernate Core
> Issue Type: Bug
> Components: annotations
> Environment: Hibernate 3.2.X, no database needed (happens during factory build before connecting to db)
> Reporter: Clint Popetz
> Attachments: propertyTypeExtractorBug.tar.gz
>
>
> The following source:
> @javax.persistence.Entity
> public class TestEntity {
>
> @javax.persistence.Id
> public int Id;
>
> public java.util.ArrayList<Object[]> badMethod() { return null; }
> public static void main(String args[]) {
> new org.hibernate.cfg.AnnotationConfiguration().addAnnotatedClass(TestEntity
> .class).configure().buildSessionFactory();
> }
> }
> will cause:
> java.lang.IllegalArgumentException: No PropertyTypeExtractor available for type void
> at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.toXType(JavaReflectionManager.java:164)^M
> at org.hibernate.annotations.common.reflection.java.JavaXMethod.create(JavaXMethod.java:18)
> at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getXMethod(JavaReflectionManager.java:128)
> at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredMethods(JavaXClass.java:114)
> at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:214)
> at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:133)
> at org.hibernate.validator.event.ValidateEventListener.initialize(ValidateEventListener.java:91)
> at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:356)
> at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1304)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
> Changing the return type to List<Object[]> avoids the bug.
> Attached is a tgz of an ant-buildable project; typing "ant run" will illustrate the bug.
--
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