Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
[b]Hibernate version:3.0[/b]
[b]Mapping documents:[/b]
[b]Code between sessionFactory.openSession() and session.close():
try
{
session = HibernateUtil.currentSession();
for (int i=0; i<smsReceivedVector.size(); i++)
{
SmsReceived smsReceived = (SmsReceived)smsReceivedVector.get(i);
Keyword key = smsReceived.getKeyword();
Set smsReceivedSet = key.getSmsReceiveds();
Hibernate.initialize(smsReceivedSet);
smsReceivedSet.add(smsReceived); // Error occured here
}
//session.flush();
isInsertOk = true;
session.beginTransaction().commit();
}
[/b]
[b]Full stack trace of any exception that occurs:
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.ore_005fsms_jsp._jspService(ore_005fsms_jsp.java:78)
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)
</pre></p><p><b>root cause</b> <pre>java.lang.Exception: Add smsReceived Error: Could not execute JDBC batch update
com.gloptv.smsc.PhoneNumber.addSmsReceived(Unknown Source)
com.gloptv.smsc.PhoneNumber$$FastClassByCGLIB$$35f1dac.invoke(<generated>)
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:137)
com.gloptv.smsc.PhoneNumber$$EnhancerByCGLIB$$152db712.addSmsReceived(<generated>)
com.gloptv.smsc.SmsParser.parseSms(Unknown Source)
org.apache.jsp.ore_005fsms_jsp._jspService(ore_005fsms_jsp.java:56)
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)
[/b]
[b]Name and version of the database you are using:postgresql 8.0[/b]
[b]The generated SQL (show_sql=true):[/b]
[b]Debug level Hibernate log excerpt:[/b]
Note that all my class are now set to lazy=true. Since, when I try to add a collection of children to a particular parent, I got the above error. Can anyone please help me solve this issue.