• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

save method shows exception in hibernate

 
sanu jony
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
while i am trying insert a value to an existing table by calling hibernate onSave method i am getting an exception.

getHibernateTemplate().save(item);
this is my command for inserting value.
i am getting following exception
net.sf.hibernate.AssertionFailure: InvocationTargetException
net.sf.hibernate.util.GetGeneratedKeysHelper.prepareStatement(GetGeneratedKeysHelper.java:49)
net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:246)
net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:524)
net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:906)
net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)
net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:757)
net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)
org.springframework.orm.hibernate.HibernateTemplate$8.doInHibernate(HibernateTemplate.java:242)
org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
org.springframework.orm.hibernate.HibernateTemplate.save(HibernateTemplate.java:240)
bus.userDAO.saveitem(userDAO.java:35)
web.PriceIncreaseFormController.onSubmit(PriceIncreaseFormController.java:41)
org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:236)
org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:208)
org.springframework.web.servlet.mvc.AbstractFormController.handleInvalidSubmit(AbstractFormController.java:411)
org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:231)
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:119)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:389)
org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:339)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:325)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

if anybody knows why this exception is arising please help me!!
The other commands like
getHibernateTemplate().load(Item.class,new Long(2) );
is workingfor me.
 
Greg Whelan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you see the stack trace of the InvocationTargetException in your Hibernate log? That likely contains some relevant information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic