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
|