1 2 Previous Next 15 Replies Latest reply on Aug 25, 2016 5:23 AM by Wolfgang Mayer

    JPA - JTA table insert/update

    Royi Bernthal Newbie

      I have a JPA application set up with JTA, here's my persistence.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      
      <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
      
        <persistence-unit name="PU" transaction-type="JTA">
      
          <jta-data-source>java:/jboss/datasources/test</jta-data-source>
          <exclude-unlisted-classes>false</exclude-unlisted-classes>
      
        <properties/>
      
        </persistence-unit>
      
      </persistence>
      
      
      
      

       

      I'd like to be able to insert/update rows in a table.

       

      I'm able to fetch data with entityManager.find(), but I'm experiencing problems with insert/update.

       

      entityManager.getTransaction() throws an exception, as I understand is expected when using JTA:

      org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()

      How am I supposed to control transactions when using JTA?

      The answers I found were for cases using hibernate directly, which is not my case, other answers simply suggested alternatives to JTA - which I'm open to, but as far as I understand things should be possible with JTA.

        • 1. Re: JPA - JTA table insert/update
          Scott Marlow Master

          Next time, you might get more responses if you show the entire exception call stack, as that helps others to know where to look.  Answer is that your not allowed to call EntityManager.getTransaction() when using JTA as briefly mentioned here.  EntityManager.getTransaction otherwise would return a EntityTransaction, which has methods that attempt to control the transaction (e.g. EntityTransaction.commit()) which would not work with JTA (instead call your JPA code inside of an already started JTA transaction).

          • 2. Re: JPA - JTA table insert/update
            Royi Bernthal Newbie

            How do I access an already started JPA transaction?

            • 3. Re: JPA - JTA table insert/update
              Scott Marlow Master

              How am I supposed to control transactions when using JTA?

              You could use an EJB container managed transaction (e.g. stateful EJB session bean).  Looks like there is a RESTEasy quickstart example, I didn't look to see if its uses JPA but you could via link.

              • 4. Re: JPA - JTA table insert/update
                Scott Marlow Master

                How do I access an already started JPA transaction?

                An already started JPA transaction, is a (RESOURCE_LOCAL) transaction that is not using JTA.  A RESOURCE_LOCAL transaction is really a transaction that is controlled by the database server.  A JTA transaction is a transaction that is controlled via the JTA api and the Narayana transaction manager.

                 

                If you want to use a RESOURCE_LOCAL transaction, you would change your persistence.xml to have:

                transaction-type="RESOURCE_LOCAL"
                • 5. Re: JPA - JTA table insert/update
                  Wolfgang Mayer Master

                  I think the method you are looking for is entityManager.joinTransaction(). Chapter 5. Transactions and Concurrency

                  • 6. Re: JPA - JTA table insert/update
                    Royi Bernthal Newbie

                    mayerw01 Thanks, I'm trying to do this:

                     

                    import javax.ejb.Stateless;
                    import javax.persistence.EntityManager;
                    import javax.persistence.PersistenceContext;
                    
                    @Stateless
                    public class Players {
                    
                      @PersistenceContext
                      private EntityManager entityManager;
                    
                      public Players() {
                    
                      }
                    
                      public Player getById(int id) {
                           return entityManager.find(Player.class, id);
                      }
                    
                      public void insert(Player player) {
                           entityManager.joinTransaction();
                           entityManager.persist(player);
                      }
                    
                    }
                    

                     

                    The following error is caused by the persist() line:

                     

                    org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                    org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)

                    org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)

                    org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)

                    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)

                    org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)

                    org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)

                    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)

                    org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)

                    javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

                    io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

                    io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

                    io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

                    org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

                    io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

                    io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

                    io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

                    io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

                    io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

                    io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

                    io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

                    io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

                    io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

                    io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)

                    io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)

                    io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

                    io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)

                    io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

                    io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)

                    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

                    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

                    java.lang.Thread.run(Unknown Source)

                     

                    The exact same error occurs even if I don't call joinTransaction() before persist().

                     

                    smarlow From what I understand from the docs JTA best suits my needs. Can you help me understand how to utilize it? If you have any straightforward code examples it'd be very helpful.

                    • 7. Re: JPA - JTA table insert/update
                      Wolfgang Mayer Master

                      This appears to be an issue during persist. Maybe you can post your Player class?

                      • 8. Re: JPA - JTA table insert/update
                        Royi Bernthal Newbie

                        Sure.

                         

                        package database;
                        
                        
                        import java.util.Date;
                        
                        
                        import javax.persistence.*;
                        
                        
                        @Entity
                        @Table(name = "player")
                        public class Player {
                        
                           @Id @GeneratedValue
                           private int id;
                           
                           private int brand_id;
                           private int affiliate_id;
                           private String name;
                           private float balance;
                           private String currency;
                           private float bet;
                           private float win;
                           private boolean ban;
                           
                           @Temporal(TemporalType.TIMESTAMP)
                           private Date date;
                           
                           public Player() { }
                           
                           public String getName() {
                              return name;
                           }
                           
                           public void setName(String value) {
                              name = value;
                           }
                           
                           public int getBrandId() {
                            return brand_id;
                           }
                           
                           public void setBrandId(int value) {
                            brand_id = value;
                           }
                           
                           public int getAffiliateId() {
                            return affiliate_id;
                           }
                           
                           public void setAffiliateId(int value) {
                            affiliate_id = value;
                           }
                           
                           public float getBalance() {
                            return balance;
                           }
                           
                           public void setBalance(float value) {
                            balance = value;
                           }
                           
                           public String getCurrency() {
                            return currency;
                           }
                           
                           public void setCurrency(String value) {
                            currency = value;
                           }
                           
                           public float getBet() {
                            return bet;
                           }
                           
                           public void setBet(float value) {
                            bet = value;
                           }
                           
                           public float getWin() {
                            return win;
                           }
                           
                           public void setWin(float value) {
                            win = value;
                           }
                           
                           public boolean getBan() {
                            return ban;
                           }
                           
                           public void setBan(boolean value) {
                            ban = value;
                           }
                           
                           public Date getDate() {
                            return date;
                           }
                           
                           public void setDate(Date value) {
                            date = value;
                           }
                           
                        }
                        
                        • 9. Re: JPA - JTA table insert/update
                          Scott Marlow Master

                          It would be more useful if we could see the call stack for the javax.persistence.PersistenceException error.  Looks like org.jboss.resteasy.core.ExceptionHandler.handleApplicationException is ignoring the original call stack, when it does "throw new UnhandledException(e.getCause());"

                          • 10. Re: JPA - JTA table insert/update
                            Royi Bernthal Newbie

                            Here you go, hopefully that's what you asked for:

                             

                            at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
                            at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
                            at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
                            at database.Players$$$view2.insert(Unknown Source)
                            at rest.Page.getHiJSON(Page.java:26)
                            at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
                            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
                            at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
                            at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
                            at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
                            at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
                            at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
                            at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
                            at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
                            at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
                            at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
                            at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
                            at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
                            at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
                            at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
                            at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
                            at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                            at java.lang.Thread.run(Unknown Source)

                             

                             

                            19:45:51,491 ERROR [org.jboss.as.ejb3.invocation] (default task-7) WFLYEJB0034: EJB Invocation failed on component Players for method public void database.Players.insert(database.Player): javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
                            at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
                            at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
                            at database.Players$$$view2.insert(Unknown Source)
                            at rest.Page.getHiJSON(Page.java:26)
                            at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
                            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
                            at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
                            at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
                            at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
                            at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
                            at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
                            at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
                            at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
                            at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
                            at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
                            at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
                            at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
                            at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
                            at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
                            at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
                            at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                            at java.lang.Thread.run(Unknown Source)

                            Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1152)
                            at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)
                            at database.Players.insert(Players.java:23)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
                            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
                            at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
                            ... 76 more

                            Caused by: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:112)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.delegateWork(JtaIsolationDelegate.java:65)
                            at org.hibernate.id.enhanced.TableStructure$1.getNextValue(TableStructure.java:125)
                            at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
                            at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:412)
                            at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
                            at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67)
                            at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
                            at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)
                            ... 107 more

                            Caused by: org.hibernate.HibernateException: Unable to perform isolated work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:139)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:100)
                            ... 120 more

                            Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist

                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                            at java.lang.reflect.Constructor.newInstance(Unknown Source)
                            at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
                            at com.mysql.jdbc.Util.getInstance(Util.java:387)
                            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
                            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
                            at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
                            at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
                            at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
                            at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
                            at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
                            at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:224)
                            at org.hibernate.id.enhanced.TableStructure.access$300(TableStructure.java:46)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:139)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:126)
                            at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:55)
                            at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:133)
                            ... 121 more

                             

                             

                            19:45:51,496 ERROR [io.undertow.request] (default task-7) UT005023: Exception handling request to /rest-test/rest/page: org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
                            at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
                            at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
                            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
                            at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
                            at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
                            at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
                            at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
                            at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
                            at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
                            at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
                            at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
                            at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
                            at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
                            at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
                            at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
                            at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
                            at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
                            at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                            at java.lang.Thread.run(Unknown Source)

                            Caused by: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
                            at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
                            at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
                            at database.Players$$$view2.insert(Unknown Source)
                            at rest.Page.getHiJSON(Page.java:26)
                            at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
                            ... 32 more

                            Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1152)
                            at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)
                            at database.Players.insert(Players.java:23)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
                            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
                            at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
                            ... 76 more

                            Caused by: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:112)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.delegateWork(JtaIsolationDelegate.java:65)
                            at org.hibernate.id.enhanced.TableStructure$1.getNextValue(TableStructure.java:125)
                            at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
                            at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:412)
                            at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
                            at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67)
                            at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
                            at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)
                            ... 107 more

                            Caused by: org.hibernate.HibernateException: Unable to perform isolated work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:139)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:100)
                            ... 120 more

                            Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist

                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                            at java.lang.reflect.Constructor.newInstance(Unknown Source)
                            at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
                            at com.mysql.jdbc.Util.getInstance(Util.java:387)
                            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
                            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
                            at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
                            at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
                            at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
                            at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
                            at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
                            at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:224)
                            at org.hibernate.id.enhanced.TableStructure.access$300(TableStructure.java:46)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:139)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:126)
                            at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:55)
                            at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:133)
                            ... 121 more

                             

                             

                            19:45:51,666 ERROR [org.hibernate.id.enhanced.TableStructure] (default task-9) could not read a hi value: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist

                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                            at java.lang.reflect.Constructor.newInstance(Unknown Source)
                            at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
                            at com.mysql.jdbc.Util.getInstance(Util.java:387)
                            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
                            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
                            at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
                            at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
                            at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
                            at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
                            at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
                            at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:224)
                            at org.hibernate.id.enhanced.TableStructure.access$300(TableStructure.java:46)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:139)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:126)
                            at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:55)
                            at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:133)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:100)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.delegateWork(JtaIsolationDelegate.java:65)
                            at org.hibernate.id.enhanced.TableStructure$1.getNextValue(TableStructure.java:125)
                            at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
                            at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:412)
                            at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
                            at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67)
                            at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
                            at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)
                            at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)
                            at database.Players.insert(Players.java:23)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
                            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
                            at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
                            at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
                            at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
                            at database.Players$$$view2.insert(Unknown Source)
                            at rest.Page.getHiJSON(Page.java:26)
                            at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
                            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
                            at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
                            at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
                            at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
                            at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
                            at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
                            at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
                            at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
                            at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
                            at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
                            at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
                            at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
                            at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
                            at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
                            at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
                            at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                            at java.lang.Thread.run(Unknown Source)

                             

                             

                            19:45:51,669 ERROR [org.jboss.as.ejb3.invocation] (default task-9) WFLYEJB0034: EJB Invocation failed on component Players for method public void database.Players.insert(database.Player): javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
                            at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
                            at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
                            at database.Players$$$view2.insert(Unknown Source)
                            at rest.Page.getHiJSON(Page.java:26)
                            at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
                            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
                            at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
                            at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
                            at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
                            at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
                            at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
                            at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
                            at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
                            at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
                            at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
                            at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
                            at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
                            at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
                            at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
                            at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
                            at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                            at java.lang.Thread.run(Unknown Source)

                            Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1152)
                            at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)
                            at database.Players.insert(Players.java:23)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
                            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
                            at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
                            ... 76 more

                            Caused by: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:112)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.delegateWork(JtaIsolationDelegate.java:65)
                            at org.hibernate.id.enhanced.TableStructure$1.getNextValue(TableStructure.java:125)
                            at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
                            at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:412)
                            at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
                            at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67)
                            at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
                            at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)
                            ... 107 more

                            Caused by: org.hibernate.HibernateException: Unable to perform isolated work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:139)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:100)
                            ... 120 more

                            Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist

                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                            at java.lang.reflect.Constructor.newInstance(Unknown Source)
                            at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
                            at com.mysql.jdbc.Util.getInstance(Util.java:387)
                            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
                            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
                            at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
                            at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
                            at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
                            at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
                            at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
                            at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:224)
                            at org.hibernate.id.enhanced.TableStructure.access$300(TableStructure.java:46)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:139)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:126)
                            at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:55)
                            at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:133)
                            ... 121 more

                             

                             

                            19:45:51,678 ERROR [io.undertow.request] (default task-9) UT005023: Exception handling request to /rest-test/rest/page: org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
                            at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
                            at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
                            at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
                            at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
                            at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
                            at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
                            at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
                            at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
                            at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
                            at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
                            at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
                            at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
                            at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
                            at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
                            at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
                            at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
                            at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
                            at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
                            at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
                            at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
                            at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                            at java.lang.Thread.run(Unknown Source)

                            Caused by: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)
                            at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
                            at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
                            at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
                            at database.Players$$$view2.insert(Unknown Source)
                            at rest.Page.getHiJSON(Page.java:26)
                            at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
                            at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
                            at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
                            ... 32 more

                            Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1152)
                            at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)
                            at database.Players.insert(Players.java:23)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
                            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
                            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
                            at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
                            at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
                            at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
                            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
                            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
                            ... 76 more

                            Caused by: org.hibernate.HibernateException: Could not apply work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:112)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.delegateWork(JtaIsolationDelegate.java:65)
                            at org.hibernate.id.enhanced.TableStructure$1.getNextValue(TableStructure.java:125)
                            at org.hibernate.id.enhanced.NoopOptimizer.generate(NoopOptimizer.java:40)
                            at org.hibernate.id.enhanced.SequenceStyleGenerator.generate(SequenceStyleGenerator.java:412)
                            at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
                            at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67)
                            at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132)
                            at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)
                            at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)
                            at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753)
                            at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)
                            ... 107 more

                            Caused by: org.hibernate.HibernateException: Unable to perform isolated work

                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:139)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWorkInNewTransaction(JtaIsolationDelegate.java:100)
                            ... 120 more

                            Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist

                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                            at java.lang.reflect.Constructor.newInstance(Unknown Source)
                            at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
                            at com.mysql.jdbc.Util.getInstance(Util.java:387)
                            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
                            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
                            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
                            at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
                            at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
                            at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
                            at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
                            at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
                            at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:224)
                            at org.hibernate.id.enhanced.TableStructure.access$300(TableStructure.java:46)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:139)
                            at org.hibernate.id.enhanced.TableStructure$1$1.execute(TableStructure.java:126)
                            at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:55)
                            at org.hibernate.jdbc.AbstractReturningWork.accept(AbstractReturningWork.java:34)
                            at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:133)
                            ... 121 more
                            • 11. Re: JPA - JTA table insert/update
                              Wolfgang Mayer Master

                              >>> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist

                              It looks like this is a bug in hibernate https://hibernate.atlassian.net/browse/HHH-10089

                              As workaround you can mention the GenerationType directly like


                              @Id @GeneratedValue(strategy=GenerationType.IDENTITY)


                              or create the hibernate_sequence like


                              CREATE TABLE `hibernate_sequence` (

                                `next_val` bigint(20) DEFAULT NULL

                              ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

                              • 12. Re: JPA - JTA table insert/update
                                Royi Bernthal Newbie

                                That was indeed the problem. I resolved it with your first solution:

                                 

                                @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
                                
                                

                                 

                                now when I try to update an existing row I get the error "detached entity passed to persist":

                                 

                                Player player = entityManager.find(Player.class, 2);
                                
                                entityManager.joinTransaction();
                                entityManager.persist(player);
                                
                                

                                 

                                20:10:27,511 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 109) WFLYUT0022: Unregistered web context: /rest-test

                                20:10:27,517 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) WFLYWELD0010: Stopping weld service for deployment rest-test.war

                                20:10:27,528 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 114) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'rest-test.war#PU'

                                20:10:27,532 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 114) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'rest-test.war#PU'

                                20:10:27,541 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0028: Stopped deployment rest-test.war (runtime-name: rest-test.war) in 31ms

                                20:10:27,541 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 114) WFLYCLINF0003: Stopped client-mappings cache from ejb container

                                20:10:27,566 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "rest-test.war" (runtime-name: "rest-test.war")

                                20:10:32,585 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) WFLYDS0004: Found rest-test.war in deployment directory. To trigger deployment create a file called rest-test.war.dodeploy

                                20:10:32,590 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "rest-test.war" (runtime-name: "rest-test.war")

                                20:10:32,622 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) WFLYJPA0002: Read persistence.xml for PU

                                20:10:32,639 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 114) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'rest-test.war#PU'

                                20:10:32,639 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 114) HHH000204: Processing PersistenceUnitInfo [

                                  name: PU

                                  ...]

                                20:10:32,640 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0003: Processing weld deployment rest-test.war

                                20:10:32,642 INFO  [org.hibernate.orm.deprecation] (ServerService Thread Pool -- 114) HHH90000001: Found usage of deprecated setting for specifying Scanner [hibernate.ejb.resource_scanner]; use [hibernate.archive.scanner] instead

                                20:10:32,644 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-2) WFLYEJB0473: JNDI bindings for session bean named 'Players' in deployment unit 'deployment "rest-test.war"' are as follows:

                                 

                                 

                                  java:global/rest-test/Players!database.Players

                                  java:app/rest-test/Players!database.Players

                                  java:module/Players!database.Players

                                  java:global/rest-test/Players

                                  java:app/rest-test/Players

                                  java:module/Players

                                 

                                 

                                20:10:32,668 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 113) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.

                                20:10:32,669 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0006: Starting Services for CDI deployment: rest-test.war

                                20:10:32,669 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 113) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.

                                20:10:32,671 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0009: Starting weld service for deployment rest-test.war

                                20:10:32,675 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 113) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.

                                20:10:32,675 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 113) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.

                                20:10:32,679 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 113) WFLYCLINF0002: Started client-mappings cache from ejb container

                                20:10:33,085 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 114) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'rest-test.war#PU'

                                20:10:33,085 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 114) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect

                                20:10:33,088 INFO  [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 114) Envers integration enabled? : true

                                20:10:33,212 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 114) RESTEASY002225: Deploying javax.ws.rs.core.Application: class JAXActivator

                                20:10:33,214 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 114) WFLYUT0021: Registered web context: /rest-test

                                20:10:33,242 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "rest-test.war" (runtime-name : "rest-test.war")

                                20:10:37,473 ERROR [org.jboss.as.ejb3.invocation] (default task-58) WFLYEJB0034: EJB Invocation failed on component Players for method public void database.Players.insert(database.Player): javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: database.Player

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

                                  at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)

                                  at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

                                  at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

                                  at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)

                                  at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

                                  at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)

                                  at database.Players$$$view11.insert(Unknown Source)

                                  at rest.Page.getHiJSON(Page.java:28)

                                  at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                                  at java.lang.reflect.Method.invoke(Unknown Source)

                                  at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)

                                  at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)

                                  at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)

                                  at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)

                                  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)

                                  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)

                                  at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)

                                  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)

                                  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)

                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

                                  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

                                  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

                                  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

                                  at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

                                  at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

                                  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

                                  at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

                                  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

                                  at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

                                  at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)

                                  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)

                                  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

                                  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)

                                  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

                                  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)

                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

                                  at java.lang.Thread.run(Unknown Source)

                                Caused by: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: database.Player

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1152)

                                  at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)

                                  at database.Players.insert(Players.java:23)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                                  at java.lang.reflect.Method.invoke(Unknown Source)

                                  at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

                                  at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)

                                  at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)

                                  at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

                                  at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)

                                  at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

                                  at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)

                                  ... 76 more

                                Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: database.Player

                                  at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:124)

                                  at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)

                                  at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775)

                                  at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)

                                  at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)

                                  ... 107 more

                                 

                                 

                                20:10:37,477 ERROR [io.undertow.request] (default task-58) UT005023: Exception handling request to /rest-test/rest/page: org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: database.Player

                                  at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)

                                  at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)

                                  at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)

                                  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)

                                  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)

                                  at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)

                                  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)

                                  at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)

                                  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

                                  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

                                  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

                                  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

                                  at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

                                  at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

                                  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

                                  at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

                                  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

                                  at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

                                  at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                                  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)

                                  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)

                                  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

                                  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)

                                  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

                                  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)

                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

                                  at java.lang.Thread.run(Unknown Source)

                                Caused by: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: database.Player

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

                                  at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)

                                  at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

                                  at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

                                  at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)

                                  at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

                                  at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)

                                  at database.Players$$$view11.insert(Unknown Source)

                                  at rest.Page.getHiJSON(Page.java:28)

                                  at rest.Page$Proxy$_$$_WeldClientProxy.getHiJSON(Unknown Source)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                                  at java.lang.reflect.Method.invoke(Unknown Source)

                                  at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)

                                  at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)

                                  at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)

                                  at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)

                                  at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)

                                  ... 32 more

                                Caused by: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: database.Player

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1608)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1152)

                                  at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)

                                  at database.Players.insert(Players.java:23)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                                  at java.lang.reflect.Method.invoke(Unknown Source)

                                  at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

                                  at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)

                                  at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)

                                  at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

                                  at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)

                                  at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

                                  at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

                                  at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

                                  at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)

                                  ... 76 more

                                Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: database.Player

                                  at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:124)

                                  at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58)

                                  at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775)

                                  at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748)

                                  at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753)

                                  at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146)

                                  ... 107 more

                                • 13. Re: JPA - JTA table insert/update
                                  Wolfgang Mayer Master

                                  persist is only valid for inserts.

                                  For updates you should use

                                  entityManager.merge(player);

                                  • 14. Re: JPA - JTA table insert/update
                                    Royi Bernthal Newbie

                                    True, works.

                                    I noticed everything works as expected even without calling joinTransaction(). Is it optional in some cases? When and why do I need it? If I understand correctly all changes are automatically part of the current active transaction when using JTA.

                                    1 2 Previous Next