-->
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: Hibernate Error(could not instantiate id generator)
PostPosted: Mon Dec 11, 2006 2:37 am 
Newbie

Joined: Fri Dec 08, 2006 2:05 am
Posts: 2
\IT was solved


Last edited by panigrahi.v on Mon Dec 11, 2006 4:31 am, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: Hibernate Error(could not instantiate id generator)
PostPosted: Mon Dec 11, 2006 3:51 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
panigrahi.v wrote:
<?xml version='1.0' encoding='windows-1252'?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Employee" table="EMPLOYEE">
<id name="id" column="EMP_ID" type="java.lang.Integer" >
<generator class="sequence"/>
</id>
<property name="name" column="EMP_NAME" type="java.lang.String" />
<property name="sal" column="SAL" type="java.lang.Double" />
</class>

</hibernate-mapping>


Well, I guess you're just missing the parameter for the sequence id generator. Have you read the ref doc ? http://www.hibernate.org/hib_docs/v3/re ... -sequences

Code:
<id name="id" type="long" column="person_id">
        <generator class="sequence">
                <param name="sequence">person_id_sequence</param>
        </generator>
</id>


But, you seem to be using MySQL, are you sure it supports sequences ? Maybe you should try using "identity" id generator instead.
Code:
<id name="id" type="long" column="person_id" unsaved-value="0">
        <generator class="identity"/>
</id>


If your app could be used on another db, you could also try and use the "native" generator, which would choose identity on mysql for example, and sequence for Oracle or Postgres.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject: Re: Hibernate Error(could not instantiate id generator)
PostPosted: Mon Dec 11, 2006 3:55 am 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
panigrahi.v wrote:
<property name="hibernate.connection.url">jdbc:mysql:///test</property>


Is this how you have entered or have you cut out the details for the posting. It should actually be
Code:
  <property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>


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.