aspose file tools*
The moose likes Object Relational Mapping and the fly likes could not insert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "could not insert " Watch "could not insert " New topic
Author

could not insert

suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 60
I am Implementing a ModelDriven interface with its getModel() mehtod in Action class and passing an object of an bean(POJO) class
to save the bean boject but it thrown an Exception like that


javax.servlet.ServletException: could not insert: [beans.CapabilityBuildingDTO]
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:518)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)


root cause

org.hibernate.exception.SQLGrammarException: could not insert: [beans.CapabilityBuildingDTO]
org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1747)
org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2149)
org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:238)
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:158)
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:429)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:424)
com.seed.ftts.dao.ToCapabilityBuildingDAO.saveCreateUpgradatonPlan(ToCapabilityBuildingDAO.java:125)
com.seed.ftts.techOffice.CapabiltyBuildingAction.newCreateCapBuliding(CapabiltyBuildingAction.java:90)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:399)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:262)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:224)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:213)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Can you show us your code?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

hi ,

are you instantiating the model in you action class?


Good luck!!
A small leak can sink a Gigantic ship.>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: could not insert
 
Similar Threads
could not insert
could not insert
Tiles problem
Setting up a database connection with Struts 2 and Tomcat 6.0
MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection