[hibernate-issues] [Hibernate-JIRA] Closed: (HBX-581) hibernate-reverse-engineering IDENTITY generator doesn't result in correct annotation
Max Rydahl Andersen (JIRA)
noreply at atlassian.com
Mon Apr 23 08:40:04 EDT 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Max Rydahl Andersen closed HBX-581.
-----------------------------------
> hibernate-reverse-engineering IDENTITY generator doesn't result in correct annotation
> -------------------------------------------------------------------------------------
>
> Key: HBX-581
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-581
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta4
> Reporter: Matt Read
>
> My hibernate.reveng.xml contains the following:
> <table catalog="Swan" schema="InsuranceLedger" name="jouJournal">
> <primary-key>
> <generator class="IDENTITY"></generator>
> </primary-key>
> </table>
> This results in the following annotations on my @Id field when generating annotated Java:
> @GenericGenerator(name="generator", strategy="IDENTITY", parameters = { } )
> @Id @GeneratedValue(generator="generator")
> @Column(name="jouSID", unique=true, nullable=false, insertable=true, updatable=true)
> public Long getsID() {
> return this.sID;
> }
> Which results in the following error at runtime:
> org.hibernate.MappingException: could not instantiate id generator
> at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:97)
> at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
> at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:181)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
> at com.catlin.architecture.dao.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:80)
> at com.catlin.insuranceledger.JournalTest.setUp(JournalTest.java:38)
> 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.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.hibernate.MappingException: could not interpret id generator strategy: IDENTITY
> at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass(IdentifierGeneratorFactory.java:108)
> at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:91)
> ... 15 more
> Replacing the generated annotation with the following works fine:
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> @Column(name="jouSID", unique=true, nullable=false, insertable=true, updatable=true)
> public Long getsID() {
> return this.sID;
> }
--
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