2 Replies Latest reply: Mar 16, 2012 2:48 AM by Jose Alvarez de Lara RSS

    Seam Persistence exception

    Jose Alvarez de Lara Novice

      Hi,

       

      I am trying a online shop webapp using Persistence against a MySQL 5.1 database.

       

      Here is my persistence.xml file,

       

      <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
        <persistence-unit name="EjemploTiendaPU" transaction-type="JTA">
          <description>Forge Persistence Unit</description>
          <provider>org.hibernate.ejb.HibernatePersistence</provider>
          <jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>
          <exclude-unlisted-classes>false</exclude-unlisted-classes>
          <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql"/>
            <property name="javax.persistence.jdbc.user" value="some user"/>
            <property name="javax.persistence.jdbc.password" value="some pass"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/ejemplo_tienda"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.transaction.flush_before_completion" value="true"/>
          </properties>
        </persistence-unit>
      </persistence>
      

       

      And I get the following exception,

       

      javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.SQLGrammarException: Table 'ejemplo_tienda.familia' doesn't exist
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:139)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:204)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:306)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
       at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
       at com.example.project.session.FamiliaDAO$$$view31.buscarTodos(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
       at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
       at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
       at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
       at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)
       at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
       at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
       at com.example.project.session.FamiliaDAO$Proxy$_$$_Weld$Proxy$.buscarTodos(FamiliaDAO$Proxy$_$$_Weld$Proxy$.java)
       at com.example.project.negocio.CatalogoService.familias(CatalogoService.java:56)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
       at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:127)
       at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:135)
       at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
       at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:202)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:306)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
       at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
       at com.example.project.negocio.CatalogoService$$$view36.familias(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
       at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
       at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
       at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
       at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)
       at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
       at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
       at com.example.project.negocio.CatalogoService$Proxy$_$$_Weld$Proxy$.familias(CatalogoService$Proxy$_$$_Weld$Proxy$.java)
       at com.example.project.view.CatalogoController.getFamilias(CatalogoController.java:174)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
       at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:127)
       at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:135)
       at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
       at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.jpa.interceptor.SFSBInvocationInterceptor.processInvocation(SFSBInvocationInterceptor.java:58)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:156)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.stateful.StatefulComponentInstanceInterceptor.processInvocation(StatefulComponentInstanceInterceptor.java:70)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:202)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:306)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
       at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.stateful.StatefulComponentIdInterceptor.processInvocation(StatefulComponentIdInterceptor.java:52)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
       at com.example.project.view.CatalogoController$$$view29.getFamilias(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
       at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
       at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
       at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
       at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)
       at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
       at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
       at com.example.project.view.CatalogoController$Proxy$_$$_Weld$Proxy$.getFamilias(CatalogoController$Proxy$_$$_Weld$Proxy$.java)
       at com.example.project.view.CatalogoController$Proxy$_$$_WeldClientProxy.getFamilias(CatalogoController$Proxy$_$$_WeldClientProxy.java)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
       at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
       at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
       at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
       at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
       at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
       at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
       at com.sun.faces.facelets.component.UIRepeat.getValue(UIRepeat.java:273)
       at com.sun.faces.facelets.component.UIRepeat.getDataModel(UIRepeat.java:249)
       at com.sun.faces.facelets.component.UIRepeat.setIndex(UIRepeat.java:443)
       at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:482)
       at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:974)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
       at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
       at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
       at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
       at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
       at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
       at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
       at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
       at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
       at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
       at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
       at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
       at java.lang.Thread.run(Thread.java:679)
      Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: Table 'ejemplo_tienda.familia' doesn't exist
       at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
       at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:261)
       at com.example.project.session.FamiliaDAO.buscarTodos(FamiliaDAO.java:42)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374)
       at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:127)
       at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:135)
       at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
       at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:84)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
       at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
       at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
       at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:202)
       ... 208 more
      Caused by: org.hibernate.exception.SQLGrammarException: Table 'ejemplo_tienda.familia' doesn't exist
       at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:82)
       at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
       at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
       at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
       at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
       at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
       at $Proxy111.executeQuery(Unknown Source)
       at org.hibernate.loader.Loader.getResultSet(Loader.java:1978)
       at org.hibernate.loader.Loader.doQuery(Loader.java:829)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
       at org.hibernate.loader.Loader.doList(Loader.java:2463)
       at org.hibernate.loader.Loader.doList(Loader.java:2449)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2279)
       at org.hibernate.loader.Loader.list(Loader.java:2274)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470)
       at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
       at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:196)
       at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1115)
       at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:252)
       ... 235 more
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ejemplo_tienda.familia' doesn't exist
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
       at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
       at com.mysql.jdbc.Util.getInstance(Util.java:386)
       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
       at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
       at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2293)
       at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:107)
       at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:616)
       at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
       ... 250 more
      

       

       

      Kind regards,

      jose

        • 1. Re: Seam Persistence exception
          Jason Porter Master

          The familia table in the ejemplo_tienda database doesn't exist. Double check all your mappings and database schema to make sure everything lines up.

          • 2. Re: Seam Persistence exception
            Jose Alvarez de Lara Novice

            Hi Jason,

             

            I did some changes in the webapp.

             

            First here is my persistence.xml file,

             

            <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
              <persistence-unit name="EjemploTiendaPU" transaction-type="JTA">
                <description>Forge Persistence Unit</description>
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>
                <exclude-unlisted-classes>false</exclude-unlisted-classes>
                <properties>
                  <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
                  <property name="hibernate.connection.username" value="some user"/>
                  <property name="hibernate.connection.password" value="some pass"/>
                  <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/ejemplo_tienda"/>
                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                  <property name="hibernate.show_sql" value="true"/>
                  <property name="hibernate.format_sql" value="true"/>
                  <property name="hibernate.transaction.flush_before_completion" value="true"/>
                </properties>
              </persistence-unit>
            </persistence>
            

             

            Second in the entity classes I have mapped to the correct table names,

             

            @Entity

            @Table(name="FAMILIA")

            @Veto

            public class Familia implements Serializable {...}

             

            that must be in uppercase because it is this way in the database.

             

            And the last change is call in the queries to the name of the entity classes instead of the table names in the database.

            I mean Familia instead of FAMILIA. No double quotes and nothing else, just the name of the entity classes.

             

            Now the webapp works fine.

             

            Regards,

            jose