On Nov 23, 2007, at 2:41 AM, Joachim Ansorg wrote:

Hi,
I'm using an Appfuse 2.0 jpa+spring+struts2 fullsource project.
I configured the hibernate dialect for jpa to use org.hibernate.dialect.MySQL5InnoDBDialect .
I'm using
   @Id
   @GeneratedValue(strategy = GenerationType.SEQUENCE)
   private Long id;
in an entity class. GenerationType.AUTO did work in the unit tests but stopped working in the Spring+Struts2 webapp.

Executing "mvn hibernate3:hbm2ddl" prints the attached results.
I'm clueless how to fix this. I looked into the MySQL5InnoDBDialect source code - it supports sequences. My guess would be that the dialect class could not be found, but don't know how to check this.

Does anybody know a solution to this problem?

[...]
[INFO] No hibernate configuration file loaded.
[INFO] Configuration Properties file loaded: D:\Projekte \OnlinePlaner2\core\target\test-classes\jdbc.properties [INFO] ---------------------------------------------------------------------- --
[ERROR] FATAL ERROR
[INFO] ---------------------------------------------------------------------- --
[INFO] could not instantiate id generator
Dialect does not support sequences
[INFO] ---------------------------------------------------------------------- --
[INFO] Trace
org.hibernate.MappingException: could not instantiate id generator
at org.hibernate.id.IdentifierGeneratorFactory.create (IdentifierGeneratorFactory.java:98) at org.hibernate.mapping.SimpleValue.createIdentifierGenerator (SimpleValue.java:152) at org.hibernate.cfg.Configuration.iterateGenerators (Configuration.java:641) at org.hibernate.cfg.Configuration.generateDropSchemaScript (Configuration.java:752) at org.hibernate.tool.hbm2ddl.SchemaExport.<init> (SchemaExport.java:93) at org.hibernate.tool.hbm2ddl.SchemaExport.<init> (SchemaExport.java:61) at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute (Hbm2DDLExporterMojo.java:96) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute (HibernateExporterMojo.java:140) at org.apache.maven.plugin.DefaultPluginManager.executeMojo (DefaultPluginManager.java:443) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals (DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneG oal(DefaultLifecycleExecutor.java:493) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal (DefaultLifecycleExecutor.java:463) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHand leFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegment s(DefaultLifecycleExecutor.java:278) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute (DefaultLifecycleExecutor.java:143) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java: 334)
       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
       at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
       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:597)
at org.codehaus.classworlds.Launcher.launchEnhanced (Launcher.java:315)
       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode (Launcher.java:430)
       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.hibernate.MappingException: Dialect does not support sequences

From this error - it looks like you might need to use auto-generated keys, or possibly you need more information/annotations when using a sequence.

Matt

at org.hibernate.dialect.Dialect.getSequenceNextValString (Dialect.java:570) at org.hibernate.id.SequenceGenerator.configure (SequenceGenerator.java:65) at org.hibernate.id.SequenceHiLoGenerator.configure (SequenceHiLoGenerator.java:43) at org.hibernate.id.IdentifierGeneratorFactory.create (IdentifierGeneratorFactory.java:94)
       ... 25 more

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to