org.hibernate.MappingException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • On startup of JBossAS I see this in the boot.log file: 17:53:43,896 INFO [DatabaseMetadata] table not found: hibernate_sequence 17:53:43,898 ERROR [SchemaUpdate] could not complete schema update: org.hibernate.MappingException: Dialect does not support pooled sequences at org.hibernate.dialect.Dialect.getCreateSequenceString(Dialect.java:734) [:3.5.5-Final] at org.hibernate.dialect.Dialect.getCreateSequenceStrings(Dialect.java:692) [:3.5.5-Final] at org.hibernate.id.enhanced.SequenceStructure.sqlCreateStrings(SequenceStructure.java:156) [:3.5.5-Final] at org.hibernate.id.enhanced.SequenceStyleGenerator.sqlCreateStrings(SequenceStyleGenerator.java:363) [:3.5.5-Final] at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:1142) [:3.5.5-Final] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:187) [:3.5.5-Final] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:386) [:3.5.5-Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) [:3.5.5-Final] at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954) [:3.5.5-Final] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:891) [:3.5.5-Final] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [:3.5.5-Final] at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47) [:1.0.2-alpha-1] at org.jboss.as.jpa.scanner.HackCEMFBuilder.build(HackCEMFBuilder.java:49) [:6.0.0-SNAPSHOT] at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275) [:1.0.2-alpha-1] I created the sequence manually but during next startup the same error message. I enabled the logging of database statements and found this: QUERY: (OPTIMIZATION TIMESTAMP: 09-19-2010 17:53:43) ------ select tabname, tabtype, owner, tabid from jboss6:informix.systables where tabtype in ('T','V') and tabname like 'hibernate_sequence' and owner like '%' Estimated Cost: 10 Estimated # of Rows Returned: 3 1) informix.systables: SEQUENTIAL SCAN Filters: ((informix.systables.tabtype IN ('T' , 'V' )AND informix.systables.tabname LIKE 'hibernate_sequence' ) AND informix.systables.owner LIKE '%' ) Hibernate is looking for a table or view named "hibernate_sequence" and not for a sequence of this name.
    via by Frank Langelage,
  • On startup of JBossAS I see this in the boot.log file: 17:53:43,896 INFO [DatabaseMetadata] table not found: hibernate_sequence 17:53:43,898 ERROR [SchemaUpdate] could not complete schema update: org.hibernate.MappingException: Dialect does not support pooled sequences at org.hibernate.dialect.Dialect.getCreateSequenceString(Dialect.java:734) [:3.5.5-Final] at org.hibernate.dialect.Dialect.getCreateSequenceStrings(Dialect.java:692) [:3.5.5-Final] at org.hibernate.id.enhanced.SequenceStructure.sqlCreateStrings(SequenceStructure.java:156) [:3.5.5-Final] at org.hibernate.id.enhanced.SequenceStyleGenerator.sqlCreateStrings(SequenceStyleGenerator.java:363) [:3.5.5-Final] at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:1142) [:3.5.5-Final] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:187) [:3.5.5-Final] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:386) [:3.5.5-Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) [:3.5.5-Final] at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954) [:3.5.5-Final] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:891) [:3.5.5-Final] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [:3.5.5-Final] at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47) [:1.0.2-alpha-1] at org.jboss.as.jpa.scanner.HackCEMFBuilder.build(HackCEMFBuilder.java:49) [:6.0.0-SNAPSHOT] at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275) [:1.0.2-alpha-1] I created the sequence manually but during next startup the same error message. I enabled the logging of database statements and found this: QUERY: (OPTIMIZATION TIMESTAMP: 09-19-2010 17:53:43) ------ select tabname, tabtype, owner, tabid from jboss6:informix.systables where tabtype in ('T','V') and tabname like 'hibernate_sequence' and owner like '%' Estimated Cost: 10 Estimated # of Rows Returned: 3 1) informix.systables: SEQUENTIAL SCAN Filters: ((informix.systables.tabtype IN ('T' , 'V' )AND informix.systables.tabname LIKE 'hibernate_sequence' ) AND informix.systables.owner LIKE '%' ) Hibernate is looking for a table or view named "hibernate_sequence" and not for a sequence of this name.
    via by Frank Langelage,
  • How to use a different database
    via j-trac by shaggy9
    ,
  • Running under PostgreSQL
    via j-trac by stdunbar
    ,
  • JTrac / Discussion / Help:Running under PostgreSQL
    via by Unknown author,
  • While generating DDL scripts for mapping files that declare id <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator"> the following exception is thrown: org.hibernate.MappingException: Dialect does not support pooled sequences at org.hibernate.dialect.Dialect.getCreateSequenceString(Dialect.java:701) at org.hibernate.dialect.Dialect.getCreateSequenceStrings(Dialect.java:659) at org.hibernate.id.enhanced.SequenceStructure.sqlCreateStrings(SequenceStructure.java:139) at org.hibernate.id.enhanced.SequenceStyleGenerator.sqlCreateStrings(SequenceStyleGenerator.java:328) at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:945) at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:129) at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:91) I suspect the cause is in org.hibernate.dialect.Dialect#getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) if ( supportsPooledSequences() ) { return getCreateSequenceString( sequenceName ) + " start with " + initialValue + " increment by " + incrementSize; } throw new MappingException( "Dialect does not support pooled sequences" ); This call requires not just that dialect supports sequences but that dialect supports pooled sequences. But the algorithm that tries to determine whether the table should be used to emulate the sequence lets the dialects that supports sequences but not pooled sequences to slip through. It looks like the DB2 and SAPDB dialects fail in this category because of: org.hibernate.id.enhanced.SequenceStyleGenerator#configure(Type type, Properties params, Dialect dialect) ... if ( dialect.supportsSequences() && !forceTableUse ) { if ( OptimizerFactory.POOL.equals( optimizationStrategy ) && !dialect.supportsPooledSequences() ) { forceTableUse = true; log.info( "Forcing table use for sequence-style generator due to pooled optimizer selection where db does not support pooled sequences" ); } } To workaround the problem I have created my generator that overrides SequenceStyleGenerator#configure, somethng like: public void configure(Type type, Properties params, Dialect dialect) throws MappingException { if (dialect.supportsSequences() && !dialect.supportsPooledSequences()) { params.setProperty(FORCE_TBL_PARAM, "true"); } super.configure(type, params, dialect); Attached is a zip file with a small maven project with unit-test that replicates the problem. It generates DDL for different databases: Hipersonic, Derby, Oracle, MySql, PostgreSQL, MSSQL, DB2, and SAPDB. The data-model contains 2 tables Person and Event in many-to-many relation.
    via by Damir Malenicic,
    • org.hibernate.MappingException: Dialect does not support pooled sequences at org.hibernate.dialect.Dialect.getCreateSequenceString(Dialect.java:734)[:3.5.5-Final] at org.hibernate.dialect.Dialect.getCreateSequenceStrings(Dialect.java:692)[:3.5.5-Final] at org.hibernate.id.enhanced.SequenceStructure.sqlCreateStrings(SequenceStructure.java:156)[:3.5.5-Final] at org.hibernate.id.enhanced.SequenceStyleGenerator.sqlCreateStrings(SequenceStyleGenerator.java:363)[:3.5.5-Final] at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:1142)[:3.5.5-Final] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:187)[:3.5.5-Final] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:386)[:3.5.5-Final] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)[:3.5.5-Final] at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)[:3.5.5-Final] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:891)[:3.5.5-Final] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)[:3.5.5-Final] at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47)[:1.0.2-alpha-1] at org.jboss.as.jpa.scanner.HackCEMFBuilder.build(HackCEMFBuilder.java:49)[:6.0.0-SNAPSHOT] at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275)[:1.0.2-alpha-1]
    No Bugmate found.