I just upgraded to the newest version of HXTT Access (v3.0.010) and also downloaded the current hibernate support package. After everything worked fine with v2.1, I now get an exception, when trying to insert a record into the database (via Hibernate):
org.hibernate.HibernateException: The database returned no natively generated identity value
at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:33)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:74)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
I am using java.lang.String identifiers and let hibernate chose the generator type. Using the old version a file named "hibernate_sequence.SEQ" was created automatically in the directory of the .mdb file when the Hibernate SessionFactory was created. The new version does not.
Please explain your changes around this point and suggest a clean way to generate string identifiers.
Thank you in advance.
Aendy
|
I'm a bit disappointed, that there is still no reaction to my question after more than two days. Nevertheless I digged around some more and achieved a better understanding of the problem.
Since July of this year you have changed the hibernate support package. The HXTT dialect now tells Hibernate, that HXTT supports identity columns. If you let hibernate automatically chose the identifier generation strategy, it will select the IdentityGenerator in case identity columns are supported.
Using this configuration all tables will be created with auto increment primary key columns. But any attempt to insert records into the database via hibernate will produce the exception shown above. The dialect method "getIdentitySelectString" might play a role in this game, maybe also other dialect methods. Unfortunately I'm not able to fix the problem myself, without knowldge of the internals of the HXTT JDBC driver implementation.
I really like to use auto increment primary columns with HXTT and hibernate's IdentityGenerator. Any suggestions?
Aendy
|
>I'm a bit disappointed, that there is still no reaction to my question after more than two days.
Sorry. Because we're digging out that issue. Please download the latest package.
>If you let hibernate automatically chose the identifier generation strategy, it
>will select the IdentityGenerator in case identity columns are supported.
>The dialect method "getIdentitySelectString" might play a role in this game,
>maybe also other dialect methods.
Yeah. Because it seems that Hibernate hasn't distinguished identity column and sequence by two different methods, so that we have complemented try-failed-retry code to let HXTT Access can skip that issue. Please try the latest pacakge.
>The dialect method "getIdentitySelectString" might play a role in this game,
You can continue using your old code or try new feature. Thanks for your report.
|
Thanks for your response.
I have downloaded the new Access JDBC 3.0 Package and also the Hibernate Support Package, although this wasn't changed. Unfortunately the problem still remains. I am not able to use hibernate's IdentityGenerator. I still get the Exception shown above.
Please check. Thank you in advance.
Aendy
|