[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-2472) Error in HSQLDB Sequence Syntax

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Mar 7 07:59:32 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2472?page=all ]
     
Steve Ebersole closed HHH-2472:
-------------------------------

    Resolution: Rejected

HSQLDB has "sketchy" support for sequences.  To retrieve the NEXTVAL, you must perform a select *against a table*; however, they do not define any standard table against which we can perform a select (ala DUAL in Oracle).  

The "dual_GEN_PC_SEQUENCE" comes from how Hibernate deals with this when it exports the schema.  For each sequence, it creates a parallel table against which it can select for the sequence's NEXTVAL.

If that does not work for you, then create a subclass of HSQLDialect and override getSequenceNextValString() appropriately

> Error in HSQLDB Sequence Syntax
> -------------------------------
>
>          Key: HHH-2472
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2472
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.2.2
>     Reporter: Aaron Mulder

>
>
> I am using Hibernate via JPA.  My persistence.xml has this:
>         <provider>org.hibernate.ejb.HibernatePersistence</provider>
>         <properties>
>             <property name="hibernate.show_sql" value="true"/>
>             <property name="hibernate.format_sql" value="true"/>
>             <property name="hibernate.dialect"
>                       value="org.hibernate.dialect.HSQLDialect"/>
>         </properties>
> My Entity has this:
> @SequenceGenerator(name = "GeneratePCSequence", sequenceName = "GEN_PC_SEQUENCE")
> ...
>     @Id
>     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "GeneratePCSequence")
>     private int id;
> My DDL has this:
> create sequence GEN_PC_SEQUENCE start with 100000 increment by 1;
> The result I get when creating a new entity of this type is this:
> java.sql.SQLException: Table not found in statement [select next value for GEN_PC_SEQUENCE from dual_GEN_PC_SEQUENCE]
> 	org.hsqldb.jdbc.Util.throwError(Unknown Source)
> 	org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
> 	org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
> 	org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:185)
> 	org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
> 	org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:497)
> 	org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:123)
> 	org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:73)
> 	org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:58)
> 	org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
> 	org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
> 	org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
> 	org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
> 	org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
> 	org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
> 	org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
> 	org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
> The "from dual_GEN_PC_SEQUENCE" looks sketchy to me, but I'm not real sure.

-- 
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