-->
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: org.hibernate.MappingException: could not instantiate id gen
PostPosted: Tue Jun 13, 2006 3:18 am 
Regular
Regular

Joined: Fri Nov 12, 2004 12:07 am
Posts: 57
Location: Beijing,China
Hi,
I encountered a oddish problem with hibernate3 today.
It is my first time developing with hibernate3,i always developed with hibernate2.8 in the past months and didn't encountered this problem.The thing is very simple,I have a pojo object as follow:

public final class ExampleModel {
private Long exampleId;
private String name;

public ExampleModel() {
}

public Long getExampleId(){
return exampleId;
}

public void setExampleId(Long exampleId){
this.exampleId=exampleId;
}

public String getName(){
return name;
}

public void setName(String name){
this.name=name;
}

}

and ExampleModel.hbm.xml as follow:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.chinaclear.isin.model.example.ExampleModel" table="example_tab">
<id name="exampleId" column="example_id" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">SEQUENCE_ENGINE</param>
</generator>
</id>
<property name="name" column="name" type="string"/>
</class>
</hibernate-mapping>

My db is db2. The error message "org.hibernate.MappingException: could not instantiate id generator" always presents.but with hibernate2.8 all is ok.

What's wrong with my project? Can anybody tell me?

Thanks


Hibernate version:

Hibernate3.0

Mapping documents:


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

Full stack trace of any exception that occurs:

org.hibernate.MappingException: could not instantiate id generator

Name and version of the database you are using:

db2 8.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: Hi
PostPosted: Tue Jun 13, 2006 3:27 am 
Regular
Regular

Joined: Fri Nov 12, 2004 12:07 am
Posts: 57
Location: Beijing,China
I tried directly issuing sql statement

insert into example_tab (example_id,name)
values
(nextval for SEQUENCE_ENGINE,'abc')

successfully.

is it a bug of hibernate3?


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.