[hibernate-issues] [Hibernate-JIRA] Created: (ANN-668) Method in entity with return type of ArrayList<Object[]> causes failure to build session factory

Clint Popetz (JIRA) noreply at atlassian.com
Mon Oct 22 19:25:38 EDT 2007


Method in entity with return type of ArrayList<Object[]> causes failure to build session factory
------------------------------------------------------------------------------------------------

                 Key: ANN-668
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-668
             Project: Hibernate Annotations
          Issue Type: Bug
    Affects Versions: 3.3.0.ga
         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