-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: sequence support for hsqldb?
PostPosted: Mon Oct 18, 2004 10:27 pm 
Newbie

Joined: Mon Oct 18, 2004 10:04 pm
Posts: 7
I'm trying to access HSQLDB through Hibernate over a Spring local session factory. HSQLDB 1.7.2 introduced sequences and identity columns, and the Hibernate HSQLDB Dialect doesn't seem to support it. Is there any plans to add it in the near future? (I know I can work around with a hilo generator, just out of curiosity and would still prefer a sequence.)

--mr

Hibernate version:
2.1.6

Mapping documents:
Code:
<id name="id_" column="id" type="long" unsaved-value="0" access="field">
  <generator class="sequence">
  <param name="sequence">Id_Generator</param>
  </generator>
</id>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
Code:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'session-factory' defined in file [E:\java\main-context.xml]: Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: could not instantiate id generator
net.sf.hibernate.MappingException: could not instantiate id generator
   at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:82)
   at net.sf.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:82)
   at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:635)
   at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:716)
   at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
   at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:136)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:791)
   at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:467)
   at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:405)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1057)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:287)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:205)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:230)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284)
   at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:83)
   at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:68)
   at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:59)
   ... 1 more
Caused by: net.sf.hibernate.MappingException: Dialect does not support sequences
   at net.sf.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:319)
   at net.sf.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:62)
   at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:78)
   ... 19 more


Name and version of the database you are using:
HSQLDB 1.7.2
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 18, 2004 10:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There are multiple Dialect for Oracle no reason to have the same for other databases. So create a dilect named appropriately (consider extending the existing one), test it, submit the code/patch to JIRA.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 18, 2004 10:59 pm 
Newbie

Joined: Mon Oct 18, 2004 10:04 pm
Posts: 7
In fact I have since found out that it does support identity columns which suits me well... Thanks.

In your reply did you mean "no reason not to have the same for other databases"?

--mr


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.