[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Hibernate Problem in saving records

Posted on 2007-07-29
4
Medium Priority
?
964 Views
Last Modified: 2010-05-18
hi guys
           i have a problem i want to try to save many entities in hibernate entities have also composite keys i am getting this exception on saving i tried to solve it but i couldn't any help would be appreciated

Thank You

at org.hibernate.type.AbstractType.getHashCode(AbstractType.java:112)
09:53:24,859 ERROR [STDERR]       at org.hibernate.type.AbstractType.getHashCode(AbstractType.java:120)
09:53:24,859 ERROR [STDERR]       at org.hibernate.type.EntityType.getHashCode(EntityType.java:402)
09:53:24,859 ERROR [STDERR]       at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:162)
09:53:24,859 ERROR [STDERR]       at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:103)
09:53:24,859 ERROR [STDERR]       at org.hibernate.engine.EntityKey.<init>(EntityKey.java:47)
09:53:24,859 ERROR [STDERR]       at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:147)
09:53:24,859 ERROR [STDERR]       at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:114)
09:53:24,859 ERROR [STDERR]       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
09:53:24,859 ERROR [STDERR]       at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
09:53:24,859 ERROR [STDERR]       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
09:53:24,859 ERROR [STDERR]       at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
09:53:24,859 ERROR [STDERR]       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
09:53:24,859 ERROR [STDERR]       at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
09:53:24,859 ERROR [STDERR]       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
09:53:24,859 ERROR [STDERR]       at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.shipping.dao.ShippingProfileZoneDAO.save(ShippingProfileZoneDAO.java:32)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.shipping.dao.ShippingProfileZoneHandler.save(ShippingProfileZoneHandler.java:38)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.shipping.dao.ShippingProfileZoneHandler.makeAction(ShippingProfileZoneHandler.java:160)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.shipping.businesslogic.ShippingProfileManager.addUpdateShippingProfile(ShippingProfileManager.java:160)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.shipping.businesslogic.ShippingProfileManager.processRequest(ShippingProfileManager.java:58)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.workflow.WorkProcessor.startFlow(WorkProcessor.java:87)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.shipping.businessdelegates.ShippingProfileDelegate.doBusinessService(ShippingProfileDelegate.java:202)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.shipping.businessdelegates.ShippingProfileDelegate.createRequest(ShippingProfileDelegate.java:128)
09:53:24,859 ERROR [STDERR]       at com.org.siteelf.customermanager.struts.actionforms.ControllerAction.execute(ControllerAction.java:217)
09:53:24,859 ERROR [STDERR]       at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
09:53:24,859 ERROR [STDERR]       at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
09:53:24,859 ERROR [STDERR]       at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
09:53:24,859 ERROR [STDERR]       at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
09:53:24,859 ERROR [STDERR]       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
09:53:24,875 ERROR [STDERR]       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
09:53:24,875 ERROR [STDERR]       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
09:53:24,875 ERROR [STDERR]       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
09:53:24,875 ERROR [STDERR]       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
09:53:24,875 ERROR [STDERR]       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
09:53:24,875 ERROR [STDERR]       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
09:53:24,875 ERROR [STDERR]       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
09:53:24,875 ERROR [STDERR]       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
09:53:24,875 ERROR [STDERR]       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
09:53:24,875 ERROR [STDERR]       at java.lang.Thread.run(Thread.java:595)
0
Comment
Question by:SiteElf
3 Comments
 
LVL 9

Expert Comment

by:sanjooz
ID: 19665793
How about some description of your issue? Nobody can decipher your problem through the stack trace.
0
 
LVL 1

Accepted Solution

by:
ulfreich2 earned 2000 total points
ID: 19708889
You should declare equals() and hashcode() methods for the persistent classes, which allow hibernate (and java in general) to differentiate 2 objects. Refer to: http://www.hibernate.org/109.html.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20143825
Forced accept.

Computer101
EE Admin
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question