[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2849?page=c...
]
Antony Stubbs commented on HHH-2849:
------------------------------------
Just to comment - I have now tested this patch and it works. It generated the following
output:
java.lang.ExceptionInInitializerError
at com.x.tests.hibernate.BasicTankerSetupTest.beforeClass(BasicTankerSetupTest.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
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.RuntimeException: Exception building SessionFactory: could not
instantiate id generator for entity 'com.x.persistence.hibernate.Tanker'
at com.x.tests.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:20)
... 14 more
Caused by: org.hibernate.MappingException: could not instantiate id generator for entity
'com.x.persistence.hibernate.Tanker'
at
org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:195)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.x.tests.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:18)
... 14 more
Caused by: org.hibernate.MappingException: could not interpret id generator strategy:
com.x.sdfsdf.persistence.hibernate.TriggerAssignedIdentityGenerator
at
org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass(IdentifierGeneratorFactory.java:109)
at
org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:92)
... 18 more
Better error logging in IdentifierGeneratorFactory.java
-------------------------------------------------------
Key: HHH-2849
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2849
Project: Hibernate3
Issue Type: Patch
Components: core
Affects Versions: 3.2.4.sp1, 3.3
Reporter: Antony Stubbs
Priority: Minor
Attachments: IdentifierGeneratorFactory.java.patch,
IdentifierGeneratorFactory.java.patch
Original Estimate: 1 hour
Remaining Estimate: 1 hour
When specifying an incorrect id generator class in the hibernate mapping file, the
following error messages are produced for the exception:
Caused by: java.lang.RuntimeException: Exception building SessionFactory: could not
instantiate id generator
Caused by: org.hibernate.MappingException: could not instantiate id generator
Caused by: org.hibernate.MappingException: could not interpret id generator strategy:
com.x.persistence.sdfhibernate.SomeIdentityGenerator
This doesn't show which mapping it's talking about.
The patch I submitted slightly improves the message by adding the entity name:
Caused by: org.hibernate.MappingException: could not instantiate id generator for entity
com.x.persistence.hibernate.EntityClass
admitedly I haven't tested it yet, because I am unable to get maven to build
hibernate. but i'm working on that now (unable to download
org.codehaus.mojo:antlr-maven-plugin:pom:2.0-SNAPSHOT)
--
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