-->
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: sequence does not exist
PostPosted: Sun Aug 27, 2006 8:11 pm 
Newbie

Joined: Sun Aug 27, 2006 8:04 pm
Posts: 1
Hello All,
I am new to this Hibernate, had the following problem working with it:

Have a Oracle Table:
Code:
Table Name: CAR and following columns
id integer
make varchar
model varchar
model_year varchar

CarDTO-hbm-xml

<hibernate-mapping>
   <class name="com.rnd.dto.CarDTO" table="CAR">
      <id name="id" column="ID" type="int">
         <generator class="native" />
      </id>
      
      <property name="make" type="java.lang.String" column="MAKE"/>
      <property name="model" type="java.lang.String" column="MODEL"/>
      <property name="modelYear" type="java.lang.String" column="MODEL_YEAR"/>
   </class>
</hibernate-mapping>



When saving a car, the following exception is being thrown:

Code:


17:53:17,657 ERROR [JDBCExceptionReporter] ORA-02289: sequence does not exist

17:53:17,657 ERROR [STDERR] org.hibernate.exception.SQLGrammarException: could not get next sequence value
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
        at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:98)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
        at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
        at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
        at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
        at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:537)
        at org.hibernate.impl.SessionImpl.save(SessionImpl.java:525)

......................

......................


any idea what's wrong here? How can I get Hibernate generate the ID?
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 27, 2006 9:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
If no sequence is specified then it will use the global hibernate sequence which in your case does not exist (at the moment). See the manual section for sequence id generator for more information.


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.