-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate - Sequence - Could'nt instantiate id generator
PostPosted: Sat Jun 16, 2007 11:33 pm 
Newbie

Joined: Sat Jun 16, 2007 11:13 pm
Posts: 5
Hi ,

I am new to Hibernate .
Any Help is highly appreciated.

I am using sequence generator & Oracle 9i is the database .
I am getting the error
dialect does not support sequences.



Hibernate version:2.1

Mapping documents:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>

<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:SATORA</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.username">scott</property>
<property name="hibernate.connection.password">tiger</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.show_sql">true</property>

<mapping resource="src/config/CD.hbm.xml"/>

</session-factory>
</hibernate-configuration>



<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="src.java.dao.CD" table="CD">
<id name="id" type="integer" unsaved-value="null" >
<column name="id" sql-type="int" not-null="true"/>
<generator class="sequence">
<param name="sequence">
seq_cd
</param>
</generator>
</id>
<property name="title" type="string" />
<property name="artist" type="string" />
</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():
SessionFactory factory = new Configuration().configure().buildSessionFactory();
Session session = factory.openSession();
CD cd = new CD("Sundaram Bajan","Singers");
session.save(cd);



Full stack trace of any exception that occurs:

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 src.java.presentation.Test.main(Test.java:14)
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)
... 7 more



Name and version of the database you are using: Oracle 9i


Top
 Profile  
 
 Post subject: Problem solved
PostPosted: Sat Jun 16, 2007 11:46 pm 
Newbie

Joined: Sat Jun 16, 2007 11:13 pm
Posts: 5
I solved the problem.
I changed the dialect to

net.sf.hibernate.dialect.OracleDialect


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.