Hi,
I'm creating a new IdentifierGenerator which generates a type safe Id<T> object used to identify my entities.
I have created an IdGenerator class which implements IdentifierGenerator and Configurable as follows:
Code:
@SequenceGenerator(name="idgen", sequenceName="idgenerator")
public class IdGenerator implements IdentifierGenerator, Configurable {
The entitiy that uses this Id<T> class ahs for instance
Code:
@javax.persistence.Id
@GeneratedValue(generator="idgen")
@Column(name = "userid")
private Id<User> id;
and when I run the app I have an unknow id generator expection....
Any help welcome!
Hibernate version:3.2.1-ga Full stack trace of any exception that occurs:org.hibernate.AnnotationException: Unknown Id.generator: idgen
at org.hibernate.cfg.BinderHelper.makeIdGenerator(BinderHelper.java:393)
at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1728)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1180)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:710)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:452)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1283)
at com.twolattes.ds.entities.UserTest.setUp(UserTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
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)
Name and version of the database you are using: MySQLCode: