我对 EJB 的概念很陌生。我正在尝试使用实体类将前端的值插入到数据库中,但每次我这样做时,都会收到此错误:
org.hibernate.exception.SQLGrammarException:无法在 org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) 的 org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) 处执行 JDBC 批量更新.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) 在 org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265) 在 org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:166) 在org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) 在 org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) 在 org.hibernate.impl.SessionImpl.flush(SessionImpl. java:1030) 在 org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:304) 在 org.jboss.jpa.tx.TransactionScopedEntityManager.flush(TransactionScopedEntityManager.java:216) 在 org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:92) 在 com.practice.session.EmployeeBean .addEmployee(EmployeeBean.java:59) 在 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) 在 org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) 在 org.jboss.aop.joinpoint.MethodInvocation.invokeNext( MethodInvocation.java:111) 在 org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper。invokeNext(ContainerMethodInvocationWrapper.java:72) at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138) at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)在 org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) 在 org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) 在 org.jboss.seam.intercept.SeamInvocationContext.proceed (SeamInvocationContext.java:68) 在 org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) 在 org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 在 org.jboss。 seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30) at org.jboss.seam.intercept .SeamInvocationContext.proceed(SeamInvocationContext.java:68) 在 org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) 在 org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50) 在sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在 java.lang.reflect.Method。在 org.jboss.ejb3.interceptors.aop 调用(Method.java:597)。EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83) at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:70) at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java: 62) 在 org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62) 在 sun.reflect.NativeMethodAccessorImpl 的 org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76) .invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java :597) 在 org.jboss.aop.advice.PerJoinpointAdvice。invoke(PerJoinpointAdvice.java:174) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72) at org .jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_14978629.invoke(InvocationContextInterceptor_z_fillMethod_14978629.java) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3 .interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88) at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_14978629.invoke(InvocationContextInterceptor_z_setup_14978629.java) at org.jboss.aop.joinpoint .MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor 的 org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62) .invoke(TransactionScopedEntityManagerInterceptor.java:56) 在 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) 在 org.jboss。 aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.tx.StatelessBMTInterceptor.handleInvocation(StatelessBMTInterceptor.java:106) at org.jboss.ejb3.tx.BMTInterceptor.invoke(BMTInterceptor.java: 55) 在 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68) 在 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.ejb3.tx.NullInterceptor .invoke(NullInterceptor.java:42) 在 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) 在 org. jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation. java:102) 在 org.jboss.aop.joinpoint 的 org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)。MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:182) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org .jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) ) 在 org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) 在 org.jboss.aop.joinpoint 的 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)。 MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.aspects。currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)在 org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) 在 org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:193) 在 org.jboss.ejb3.session.SessionSpecContainer.invoke (SessionSpecContainer.java:250) at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:188) at $Proxy223.addEmployee(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 在 java.lang.reflect.Method.invoke(Method.java:597) 在 org.jboss.seam.util.Reflections.invoke(Reflections.java :22) org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76) org.jboss.seam.intercept .SeamInvocationContext.proceed(SeamInvocationContext.java:56) 在 org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32) 在 org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 在org.jboss.seam.intercept.ClientSideInterceptor 中的 org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)。在 sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) 在 sun.reflect. NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.el.util .ReflectionUtil.invokeMethod(ReflectionUtil.java:335) 在 org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348) 在 org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58) 在org.jboss.el.parser.AstValue.invoke(AstValue.java:96) 在 org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) 在 com.sun.facelets.el。TagMethodExpression.invoke(TagMethodExpression.java:68) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) at javax.faces .component.UICommand.broadcast(UICommand.java:387) 在 org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321) 在 org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296) 在 org. ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253) at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)在 com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) 在 com.sun.faces.lifecycle。LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache .catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter .java:40) 在 org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 在 org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) 在 org.jboss。 seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl。doFilter(SeamFilter.java:69) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org .ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) 在 org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:295) 在 org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:373) 在org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter( SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss .seam.servlet.SeamFilter。doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss .web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:206) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 在 org.jboss.web 的 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)。 org.apache.catalina.authenticator 上的 tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)。AuthenticatorBase.invoke(AuthenticatorBase.java:442) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java: 126) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 在 org.apache.catalina.valves 的 org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) .ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :109) 在 org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve。internalProcess(ActiveRequestResponseCacheValve.java:74) at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:47) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)在 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) 在 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599) 在 org.apache.tomcat.util.net .JIoEndpoint$Worker.run(JIoEndpoint.java:451) at java.lang.Thread.run(Thread.java:619) 原因:java.sql.BatchUpdateException:ORA-00904:“EMPLOYEEID”:标识符无效CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)在 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451) 在 java.lang.Thread.run(Thread.java:619) 引起:java.sql.BatchUpdateException: ORA-00904 :“EMPLOYEEID”:无效标识符CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)在 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451) 在 java.lang.Thread.run(Thread.java:619) 引起:java.sql.BatchUpdateException: ORA-00904 :“EMPLOYEEID”:无效标识符EMPLOYEEID": 无效标识符EMPLOYEEID": 无效标识符
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10657)
at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:774)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
这是我的实体类:
@Entity
@Table(name="EMPLOYEE", schema="SYSTEM")
public class Employee {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
private int employeeId;
private String employeeName;
private int employeeAge;
private String employeeAddress;
private String employeePhone;
private String employeeEmailAddress;
@Column(name="EMPLOYEE_ID", nullable=false, insertable=true, updatable=false)
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
@Column(name="EMPLOYEE_NAME", nullable=false, insertable=true, updatable=false)
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
@Column(name="EMPLOYEE_AGE", nullable=false, insertable=true, updatable=false)
public int getEmployeeAge() {
return employeeAge;
}
public void setEmployeeAge(int employeeAge) {
this.employeeAge = employeeAge;
}
@Column(name="EMPLOYEE_ADDRESS", nullable=false, insertable=true, updatable=false)
public String getEmployeeAddress() {
return employeeAddress;
}
public void setEmployeeAddress(String employeeAddress) {
this.employeeAddress = employeeAddress;
}
@Column(name="EMPLOYEE_PHONE", nullable=true, insertable=true, updatable=true)
public String getEmployeePhone() {
return employeePhone;
}
public void setEmployeePhone(String employeePhone) {
this.employeePhone = employeePhone;
}
@Column(name="EMPLOYEE_EMAIL_ADDRESS", nullable=false, insertable=true, updatable=false)
public String getEmployeeEmailAddress() {
return employeeEmailAddress;
}
public void setEmployeeEmailAddress(String employeeEmailAddress) {
this.employeeEmailAddress = employeeEmailAddress;
}
public Employee(){
super();
}
我正在使用 seam 2.2.1、EJB 3 和 Oracle 10g。
请帮我解决这个错误。