selectタグに外部キーを含むフォームを保存しようとしていますが、常にnullです。inspect要素を使用すると、選択したIDが送信されるため、フォームに問題があるとは言えません。誰か助けてくれませんか。形
<form:select path="categoryId">
<form:option value="0" label=" -- Please Select --" />
<form:options items="${categoryList}" itemValue="categoryId" itemLabel="categoryName"/>
</form:select>
コントローラ
@RequestMapping(value = "product", method = RequestMethod.POST)
public String addNewProduct(@ModelAttribute("product") Product product, Model model){
model.addAttribute("product", product);
purchaseOrderService.addProduct(product);
return "categories";
}
JPA
@Transactional(propagation = Propagation.REQUIRED)
public boolean saveProduct(Product product) {
EntityManager em = getEm();
em.persist(product);
return true;
}
永続オブジェクト
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name = "CATEGORY_ID", referencedColumnName = "CATEGORY_ID")
private Category categoryId;
エラー
java.lang.NoClassDefFoundError: org/hibernate/exception/LockTimeoutException
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1328)
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1300)
org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:80)
org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:512)
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy34.addProduct(Unknown Source)
com.logicalideas.purchaseorder.ProductController.addNewProduct(ProductController.java:30)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
根本的な原因
java.lang.ClassNotFoundException:org.hibernate.exception.LockTimeoutException org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)org .hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1328)org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1300)org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:80)org.springframework .orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:512)org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)org.springframework.transaction.support.AbstractPlatformTransactionManager。commit(AbstractPlatformTransactionManager.java:723)org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394)org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)org.springframework.a framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)$ Proxy34.addProduct(不明なソース)com.logicalideas.purchaseorder.ProductController.addNewProduct(ProductController。 java:30)sun.reflect.NativeMethodAccessorImpl.invoke0(ネイティブメソッド)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)sun.reflect.DelegatingMethodAccessorImpl。invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:601)org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)org.springframework.web。 method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)org.springframework.web.servlet.mvc.method。 annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapthandle(AbstractHandlerMethodAdapter.java:80)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)org.springframework.web。 servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)javax.servlet.http.HttpServlet.service(HttpServlet.java:641)javax.servlet。 http.HttpServlet.service(HttpServlet.java:722)servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)javax.servlet.http.HttpServlet.service(HttpServlet.java:641)javax.servlet.http.HttpServlet.service(HttpServlet.java:722)servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)javax.servlet.http.HttpServlet.service(HttpServlet.java:641)javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
どうもありがとう