So beheben Sie "konnte keine Anweisung ausführen; SQL [n / a]; Einschränkung [Nummerierung]; "?

8

Wie zu lösen "konnte Anweisung nicht ausführen; SQL [n / a]; Einschränkung [Nummerierung];"?

  

org.springframework.dao.DataIntegrityViolationException: konnte nicht   Anweisung ausführen; SQL [n / a]; Einschränkung [Nummerierung]; Verschachtelte Ausnahme   ist org.hibernate.exception.ConstraintViolationException: konnte nicht   Anweisung ausführen   org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException (SessionFactoryUtils.java:643)   org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible (HibernateJpaDialect.java:106)   org.springframework.orm.jpa.JpaTransactionManager.doCommit (JpaTransactionManager.java:517)   org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit (AbstractPlatformTransactionManager.java:755)   org.springframework.transaction.support.AbstractPlatformTransactionManager.commit (AbstractPlatformTransactionManager.java:724)   org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning (TransactionAspectSupport.java:475)   org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction (TransactionAspectSupport.java:270)   org.springframework.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor.java:94)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)   com.sun.proxy. $ Proxy132.saveListForm (null: -1)   sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)   sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)   sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)   java.lang.reflect.Method.invoke (Methode.java:606)   org.springframework.data.repository.core.support.RepositoryFactorySupport $ QueryExecutorMethodInterceptor.executeMethodOn (RepositoryFactorySupport.java:333)   org.springframework.data.repository.core.support.RepositoryFactorySupport $ QueryExecutorMethodInterceptor.invoke (RepositoryFactorySupport.java308)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.transaction.interceptor.TransactionInterceptor $ 1.proceedWithInvocation (TransactionInterceptor.java:96)   org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction (TransactionAspectSupport.java:260)   org.springframework.transaction.interceptor.TransactionInterceptor.invoke (TransactionInterceptor.java:94)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke (PersistenceExceptionTranslationInterceptor.java:155)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor $ LockModePopulatingMethodInterceptor.invoke (LockModeRepositoryPostProcessor.java:92)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (ExposeInvocationInterceptor.java:91)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)   com.sun.proxy. $ Proxy133.saveListForm (null: -1)   sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)   sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)   sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)   java.lang.reflect.Method.invoke (Methode.java:606)   org.springframework.aop.support.AopUtils.invokeJointpointUsingReflection (AopUtils.java:317)   org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJointpoint (ReflectiveMethodInvocation.java:183)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:150)   org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke (PersistenceExceptionTranslationInterceptor.java:155)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)   com.sun.proxy. $ Proxy134.saveListForm (null: -1)   com.qmplus.service.impl.ServiceListFormVersionImpl.save (ServiceListFormVersionImpl.java:93)   sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)   sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)   sun.reflect.DelegatingMethodAccessorImpl.Aufrufen (DelegatingMethodAccessorImpl.java:43)   java.lang.reflect.Method.invoke (Methode.java:606)   org.springframework.aop.support.AopUtils.invokeJointpointUsingReflection (AopUtils.java:317)   org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJointpoint (ReflectiveMethodInvocation.java:183)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:150)   org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke (MethodSecurityInterceptor.java:64)   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (ReflectiveMethodInvocation.java:172)   org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)   com.sun.proxy. $ Proxy135.save (null: -1)   com.qmplus.web.controller.ListFormController.save (ListFormController.java:158)   com.qmplus.web.controller.ListFormController $$ FastClassByCGLIB $$ febe95eb.invozieren (: - 1)   org.springframework.cglib.proxy.MethodProxy.invoke (MethodeProxy.java:204)   org.springframework.aop.framework.CglibAopProxy $ DynamicAdvisedInterceptor.intercept (CglibAopProxy.java:627)   com.qmplus.web.controller.ListFormController $$ EnhancerByCGLIB $$ 5bb46747.save (: - 1)   sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)   sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)   sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)   java.lang.reflect.Method.invoke (Methode.java:606)   org.springframework.web.method.support.InvocableHandlerMethod.invoke (InvocableHandlerMethod.java:219)   org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest (InvocableHandlerMethod.java:132)   org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle (ServletInvocableHandlerMethod.java:104)   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod (RequestMappingHandlerAdapter.java:745)   org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal (RequestMappingHandlerAdapter.java:686)   org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle (AbstractHandlerMethodAdapter.java:80)   org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet.java:925)   org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java:856)   org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:936)   org.springframework.web.servlet.FrameworkServlet.doPost (FrameworkServlet.java:838)   javax.servlet.http.HttpServlet.service (HttpServlet.java:647)   org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet.java:812)   javax.servlet.http.HttpServlet.service (HttpServlet.java:728)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java305)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (HiddenHttpMethodFilter.java:77)   org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   com.github.dandelion.datatables.core.web.filter.DatatablesFilter.doFilter (DatatablesFilter.java:73)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   net.bull.jamelody.MonitoringFilter.doFilter (MonitoringFilter.java:164)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   com.qmplus.web.interceptors.TenantFilter.doFilter (TenantFilter.java:60)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:330)   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke (FilterSecurityInterceptor.java:118)   org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter (FilterSecurityInterceptor.java:84)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   com.qmplus.web.util.AjaxTimeoutRedirectFilter.doFilter (AjaxTimeoutRedirectFilter.java:47)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.access.ExceptionTranslationFilter.doFilter (ExceptionTranslationFilter.java:113)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.session.SessionManagementFilter.doFilter (SessionManagementFilter.java:103)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter (AnonymousAuthenticationFilter.java:113)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.authentication.remembere.RememberMeAuthenticationFilter.doFilter (RememberMeAuthenticationFilter.java:146)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter (SecurityContextHolderAwareRequestFilter.java:54)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter (RequestCacheAwareFilter.java:45)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter (BasicAuthenticationFilter.java:150)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter (AbstractAuthenticationProcessingFilter.java:183)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.authentication.logout.LogoutFilter.doFilter (LogoutFilter.java:105)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.session.ConcurrentSessionFilter.doFilter (ConcurrentSessionFilter.java:125)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter (SecurityContextPersistenceFilter.java:87)   org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy.java:342)   org.springframework.security.web.FilterChainProxy.doFilterInternal (FilterChainProxy.java:192)   org.springframework.security.web.FilterChainProxy.doFilter (FilterChainProxy.java:160)   org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy.java:343)   org.springframework.web.filter.DelegatingFilterProxy.doFilter (DelegatingFilterProxy.java:260)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   com.github.dandelion.datatables.extras.servlet2.filter.DatatablesFilter.doFilter (DatatablesFilter.java:71)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter.java:88)   org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:107)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   net.bull.javamelody.MonitoringFilter.doFilter (MonitoringFilter.java:202)   net.bull.javamelody.MonitoringFilter.doFilter (MonitoringFilter.java:180)   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:243)   org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:210)   org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:222)   org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:123)   org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:502)   org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:171)   org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:99)   org.apache.catalina.valves.AccessLogValve.invoke (AccessLogValve.java:953)   org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:118)   org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:408)   org.apache.coyote.http11.AbstractHttp11Processor.process (AbstractHttp11Processor.java:1023)   org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process (AbstractProtocol.java:589)   org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run (JIoEndpoint.java:312)   java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)   java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:615)   java.lang.Thread.run (Thread.java:724)

    
Pankaj Sharma 12.02.2014, 12:10
quelle

3 Antworten

13

In meinem Fall passiert das, wenn ich versuche, ein Objekt im Hibernate- oder anderen orm-Mapping mit einer Null-Eigenschaft zu speichern, die in der Datenbanktabelle nicht null sein darf. Dies passiert, wenn Sie versuchen, ein Objekt zu speichern, aber die Speicheraktion nicht den Einschränkungen der Tabelle entspricht.

    
Mariuszy 24.06.2015 02:12
quelle
5

Hibernate versucht, Daten einzufügen, die die zugrunde liegenden Einschränkungen der Datenbankintegrität verletzen.

Wahrscheinlich besteht eine Fehlkonfiguration in persistenten Hibernate-Klassen und / oder Mapping-Konfigurationen (* .hbm.xml oder Anmerkungen in persistenten Klassen).

Möglicherweise ist eine Eigenschaft der Bean, die Sie speichern möchten, nicht typkompatibel mit dem zugehörigen Feld in der Datenbank (könnte den constraint [numbering] -Teil erklären).

    
Toilal 23.04.2014 05:34
quelle
2

In meinem Fall habe ich Daten aus der Datenbank abgerufen, einige Spaltenwerte geändert und in der Datenbank aktualisiert, aber für die Aktualisierung verwendete ich dieselbe Speicherabfrage, die die Primärschlüsseleinschränkungen verletzte, dh doppelte Werte für den Primärschlüssel, also hatte ich geschrieben eine separate Abfrage für die Aktualisierung der Spalten und es löste mein Problem ..!

    
Shailesh 03.11.2016 04:07
quelle

Tags und Links