-->
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: could not instantiate id generator
PostPosted: Sat Nov 06, 2004 1:47 am 
Newbie

Joined: Sat Nov 06, 2004 1:37 am
Posts: 2
Hibernate version:2.1

Mapping documents: Iam using the following mapping <br><hibernate-mapping>
<class name="test.Item" table="item" >
<id name="id" column="id" type="java.lang.Integer" >
<generator class="sequence">
<param name="sequence">item_id_sequence</param>
</generator>
</id>

<property name="name" column="name" type="java.lang.String" />
<property name="description" column="description" type="java.lang.String" />
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Transaction tx = null;
Session session = ConnectionFactory.getInstance().getSession();

try
{
tx = session.beginTransaction();

Item item = new Item();
item.setDescription(addItemForm.getDescription());
item.setName(addItemForm.getName());

session.save(item);
tx.commit();
session.flush();
}
catch (HibernateException e)
{
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);
}



Full stack trace of any exception that occurs: org.apache.jasper.JasperException: net.sf.hibernate.MappingException: could not instantiate id generator
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.RuntimeException: net.sf.hibernate.MappingException: could not instantiate id generator
test.ConnectionFactory.<init>(ConnectionFactory.java:69)
test.ConnectionFactory.getInstance(ConnectionFactory.java:103)
test.ItemService.getItemList(ItemService.java:204)
org.apache.jsp.jsp.test.AddItem_jsp._jspService(AddItem_jsp.java:120)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:274)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012)
org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Name and version of the database you are using:postgresql 7.4

The generated SQL (show_sql=true):true

any help greatly appreciated
Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 06, 2004 7:34 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
net.sf.hibernate.MappingException: could not instantiate id generator should show a nested exception.
try to majke it visible in your environment (no ex.getMessage())

_________________
Emmanuel


Top
 Profile  
 
 Post subject: RE:could not instantiate id generator
PostPosted: Thu Nov 11, 2004 6:21 am 
Newbie

Joined: Sat Nov 06, 2004 1:37 am
Posts: 2
The Mistake in the above problem was ,wrong entry in configuration ,i used
hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect
instead of using
hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect
because my database in postgres


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.