Announcement Announcement Module
Collapse
No announcement yet.
New to Spring 2.0 + JPA Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • New to Spring 2.0 + JPA

    I'm stuck.. does anybody have any ideas...

    I'm able to do selects without any problems, but inserts don't work... so it's transaction related problems....

    Here's the only suspicious thing from the logs...

    23:29:04,724 ERROR [SchemaUpdate] could not complete schema update
    java.sql.SQLException: You cannot set autocommit during a managed transaction!
    at org.jboss.resource.adapter.jdbc.BaseWrapperManaged Connection.setJdbcAutoCommit(BaseWrapperManagedCon nection.java:482)
    at org.jboss.resource.adapter.jdbc.WrappedConnection. setAutoCommit(WrappedConnection.java:322)

    [.....]
    23:29:04,744 ERROR [SchemaUpdate] Error closing connection
    java.sql.SQLException: You cannot set autocommit during a managed transaction!
    at org.jboss.resource.adapter.jdbc.BaseWrapperManaged Connection.setJdbcAutoCommit(BaseWrapperManagedCon nection.java:482)
    at org.jboss.resource.adapter.jdbc.WrappedConnection. setAutoCommit(WrappedConnection.java:322)
    at org.hibernate.tool.hbm2ddl.SuppliedConnectionProvi derConnectionHelper.release(SuppliedConnectionProv iderConnectionHelper.java:49)
    at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(Sc hemaUpdate.java:173)
    at org.hibernate.impl.SessionFactoryImpl.<init>(Sessi onFactoryImpl.java:311)
    at org.hibernate.cfg.Configuration.buildSessionFactor y(Configuration.java:1213)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityMan agerFactory(Ejb3Configuration.java:631)
    at org.hibernate.ejb.Ejb3Configuration.createEntityMa nagerFactory(Ejb3Configuration.java:760)
    at org.hibernate.ejb.Ejb3Configuration.createContaine rEntityManagerFactory(Ejb3Configuration.java:350)
    at org.hibernate.ejb.HibernatePersistence.createConta inerEntityManagerFactory(HibernatePersistence.java :119)
    at org.springframework.orm.jpa.LocalContainerEntityMa nagerFactoryBean.createNativeEntityManagerFactory( LocalContainerEntityManagerFactoryBean.java:204)
    at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:242)
    at o

    persistence.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

    <persistence-unit name="dirservices" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence </provider>
    <class>com.frostylabs.es.dirservices.domain.Contac tInfo</class>
    <class>com.frostylabs.es.dirservices.domain.Grou p</class>
    <class>com.frostylabs.es.dirservices.domain.Role </class>
    <class>com.frostylabs.es.dirservices.domain.Secure Redirect</class>
    <class>com.frostylabs.es.dirservices.domain.Site </class>
    <class>com.frostylabs.es.dirservices.domain.SiteAc cess</class>
    <class>com.frostylabs.es.dirservices.domain.SiteDo main</class>
    <class>com.frostylabs.es.dirservices.domain.User </class>
    <class>com.frostylabs.es.dirservices.domain.UserPr eferences</class>
    <class>com.frostylabs.es.dirservices.domain.UserSe ssion</class>
    <properties>
    <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
    <property name="hibernate.cache.use_second_level_cache" value="false" />
    <property name="hibernate.cache.provider_class" value="org.hibernate.cache.TreeCacheProvider" />
    </properties>

    </persistence-unit>
    </persistence>


    entity.local.xml


    <?xml version="1.0" encoding="UTF-8" ?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schem...ing-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.0.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd"
    >

    <jee:jndi-lookup id="dataSource" jndi-name="java:jdbc/dirservices" />

    <!-- JPA EntityManagerFactory setup
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityMana gerFactoryBean">
    -->
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
    <property name="persistenceUnitName" value="dirservices" />
    <property name="dataSource" ref="dataSource"/>

    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter">
    <property name="showSql" value="true"/>
    <property name="generateDdl" value="true"/>
    <property name="databasePlatform" value="org.hibernate.dialect.PostgreSQLDialect"/>
    </bean>
    </property>
    <property name="jpaPropertyMap">
    <map>
    <entry key="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
    <entry key="hibernate.cache.use_second_level_cache" value="false" />
    </map>
    </property>
    <!--
    <property name="loadTimeWeaver">
    <bean class="org.springframework.instrument.classloading .SimpleLoadTimeWeaver"/>
    </property>
    -->
    </bean>

    <tx:annotation-driven />

    <bean class="org.springframework.orm.jpa.support.Persist enceAnnotationBeanPostProcessor" />

    <bean id="siteDao" class="com.frostylabs.es.dirservices.entity.dao.im pl.jpa.SiteDAOImpl">
    <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean>

    <bean id="groupDao" class="com.frostylabs.es.dirservices.entity.dao.im pl.jpa.GroupDAOImpl">
    <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean>

    </beans>


    service.local.xml


    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schem...ing-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.0.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd">
    <!--
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    -->
    <bean id="testService" class="com.frostylabs.es.dirservices.services.core .impl.TestServiceImpl" scope="singleton">
    <property name="siteDao">
    <ref bean="siteDao" />
    </property>
    <property name="groupDao">
    <ref bean="groupDao" />
    </property>
    </bean>

    <!-- Jpa Transaction Manager -->
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <tx:advice id="serviceTxAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <tx:method name="*" propagation="REQUIRED" />
    </tx:attributes>
    </tx:advice>

    <aop:config>
    <aopointcut id="serviceMethods" expression="execution(* com.frostylabs.es.dirservices.services.core.impl.* .*Impl* (..))" />
    <aop:advisor advice-ref="serviceTxAdvice" pointcut-ref="serviceMethods" />
    </aop:config>

    </beans>



    Here's versions i'm at.. Spring 2.0.1, jboss 4.0.4 w/ ejb3/jpa, postgres8...

    the sequences are getting updated in postgres on the "saves"....

    sniplet of log:

    23:29:13,093 ERROR [STDERR] group id = 6
    23:29:13,094 ERROR [STDERR] try group id = 6
    23:30:26,296 INFO [STDOUT] Hibernate: select nextval ('siteservices.seq_groups')
    23:30:26,299 ERROR [STDERR] group id = 7
    23:30:26,300 ERROR [STDERR] try group id = 7

    The Spring Jpa DAO's is the usual extending the jpa template etc....


    I found this forum posting but doesn't seem to help me isolate the problem. http://forum.springframework.org/showthread.php?t=28395


    Much appreciation...

    Chris

  • #2
    Got a few questions to get more context....

    One thing that I noticed is that you are using both <tx:annotation-driven> and a transaction proxy. You really should only need one or the other. Not sure if that would cause you a problem or not.

    Also how are you invoking your tests? With AbstractJpaTests from Spring-mock.jar?

    One other thing to consider is I see you are using a datasource that you retrieve from jndi. Are you using EJB3 Stateless session beans? If so, are you using Container Managed Transactions?

    Comment


    • #3
      ...

      couple things,

      I've commented out the <tx:annotation-driven> and same problem as before..

      This is how I'm testing it..

      junit/cactus webapp (AbstractDependencyInjectionSpringContextTests + spring2) --> calling remote ejb3 (slsb) -> core service pojo (spring2)

      here's the code for the ejb bean

      import javax.ejb.Remote;
      import javax.ejb.Stateless;

      import org.jboss.annotation.ejb.RemoteBinding;

      import com.frostylabs.es.common.exception.EnterpriseServi ceException;
      import com.frostylabs.es.common.exception.UnrecoverableRu ntimeException;
      import com.frostylabs.es.dirservices.util.ExceptionDecora tor;


      @Stateless
      @Remote(TestService.class)
      @RemoteBinding(jndiBinding="TestService/remote")


      public class TestServiceBean extends TestServiceBase implements TestService{

      public void test() throws EnterpriseServiceException{
      try{
      getTestService().test();
      }catch(UnrecoverableRuntimeException ure){
      throw ExceptionDecorator.throwsException(ure);
      }
      } /* end method */

      public void save()throws EnterpriseServiceException{
      try{
      getTestService().save();
      }catch(UnrecoverableRuntimeException ure){
      throw ExceptionDecorator.throwsException(ure);
      }

      }

      } /* end class */

      here's the test ejb3 base

      public abstract class TestServiceBase extends EnterpriseServiceBase{

      public String getJMXObjectName(){
      return JMXObjectName.LOCAL.DIRECTORY_SERVICES + "_Test";
      }

      /*
      this where it grabs the spring managed bean.
      */
      public com.frostylabs.es.dirservices.services.core.TestSe rvice getTestService(){
      return (com.frostylabs.es.dirservices.services.core.TestS ervice)getCoreService("testService");
      } /* end method */

      } /* end class */


      as you can see... i'm not using a @Transactional tag.... so it should be using bmt by default correct?? maybe that's the problem, the default is cmt??

      Thanks for you help,

      Chris

      Comment


      • #4
        I would speculate that since you are behind a Stateless Session bean you are using CMT by default. You can try explicitly setting the transaction mode to NOT_SUPPORTED to "turn off" CMT.

        However, You can get this to work using CMT/EJB. In this case you need to remove the transaction proxy as the EJB/CMT is your transaction manager and change some settings for the Jpa implementation so that it aware of running in a managed environment. I've done this with EJB 2.1 not sure if there are any differences in EJB3. Would think that it would be easier with EJB3 since JPA is part of that spec.

        Comment


        • #5
          ...

          well here's an update..

          i checked the ejb3 spec, and the default is CMT, so i've changed it to BMT

          @Stateless
          @Remote(TestService.class)
          @RemoteBinding(jndiBinding="TestService/remote")
          @TransactionManagement(TransactionManagementType.B EAN)


          i've also changed the persistence.xml to this:

          <?xml version="1.0" encoding="UTF-8"?>
          <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
          <!--
          <persistence-unit name="dirservices" transaction-type="RESOURCE_LOCAL">
          -->
          <persistence-unit name="dirservices" transaction-type="JTA">

          <provider>org.hibernate.ejb.HibernatePersistence </provider>

          <class>com.frostylabs.es.dirservices.domain.Contac tInfo</class>
          <class>com.frostylabs.es.dirservices.domain.Grou p</class>
          <class>com.frostylabs.es.dirservices.domain.Role </class>
          <class>com.frostylabs.es.dirservices.domain.Secure Redirect</class>
          <class>com.frostylabs.es.dirservices.domain.Site </class>
          <class>com.frostylabs.es.dirservices.domain.SiteAc cess</class>
          <class>com.frostylabs.es.dirservices.domain.SiteDo main</class>
          <class>com.frostylabs.es.dirservices.domain.User </class>
          <class>com.frostylabs.es.dirservices.domain.UserPr eferences</class>
          <class>com.frostylabs.es.dirservices.domain.UserSe ssion</class>

          <!--
          <jta-data-source>java:jdbc/dirservices</jta-data-source>
          -->
          <properties>
          <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionM anagerLookup"/>
          <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
          <property name="hibernate.cache.use_second_level_cache" value="false" />
          <property name="hibernate.cache.provider_class" value="org.hibernate.cache.TreeCacheProvider" />
          </properties>


          </persistence-unit>
          </persistence>


          this fixed: java.sql.SQLException: You cannot set autocommit during a managed transaction!

          however... data still isn't being persisted... sequences are still be incremented...

          I'm at a lost... I'm going to post the console log .... Does anyone see anything weird/missing in it?

          Thanks,

          Chris

          Comment


          • #6
            Console Log

            ************************************************** **********
            22:30:11,042 INFO [CollectionFactory] JDK 1.4+ collections available
            22:30:11,161 INFO [CollectionFactory] Commons Collections 3.x available
            22:30:11,830 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [com/frostylabs/es/dirservices/ioc/context.xml]
            22:30:13,041 INFO [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [test,local]; root of BeanFactory hierarchy]
            22:30:13,959 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [com/frostylabs/es/dirservices/ioc/entity.local.xml]
            22:30:14,216 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [com/frostylabs/es/dirservices/ioc/services.local.xml]
            22:30:15,031 INFO [ClassPathXmlApplicationContext] Bean factory for application context [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=12185208]: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [dataSource,entityManagerFactory,org.springframewor k.orm.jpa.support.PersistenceAnnotationBeanPostPro cessor,siteDao,groupDao,testService,transactionMan ager,serviceTxAdvice,org.springframework.aop.confi g.internalAutoProxyCreator,serviceMethods,org.spri ngframework.aop.support.DefaultPointcutAdvisor]; root of BeanFactory hierarchy
            22:30:15,164 INFO [ClassPathXmlApplicationContext] 11 beans defined in application context [org.springframework.context.support.ClassPathXmlAp plicationContext;hashCode=12185208]
            22:30:15,441 INFO [ClassPathXmlApplicationContext] Bean 'org.springframework.orm.jpa.support.PersistenceAn notationBeanPostProcessor' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
            22:30:15,479 INFO [DefaultAopProxyFactory] CGLIB2 available: proxyTargetClass feature enabled
            22:30:15,801 INFO [ClassPathXmlApplicationContext] Bean 'org.springframework.aop.config.internalAutoProxyC reator' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
            22:30:15,827 INFO [ClassPathXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMess [email protected]]
            22:30:15,993 INFO [ClassPathXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicatio [email protected]]
            22:30:16,003 INFO [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [dataSource,entityManagerFactory,org.springframewor k.orm.jpa.support.PersistenceAnnotationBeanPostPro cessor,siteDao,groupDao,testService,transactionMan ager,serviceTxAdvice,org.springframework.aop.confi g.internalAutoProxyCreator,serviceMethods,org.spri ngframework.aop.support.DefaultPointcutAdvisor]; root of BeanFactory hierarchy]
            22:30:17,723 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
            name: dirservices
            ...]
            22:30:17,812 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.ContactInfo
            22:30:17,817 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.Group
            22:30:17,821 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.Role
            22:30:17,849 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.SecureRedirec t
            22:30:17,882 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.Site
            22:30:17,894 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.SiteAccess
            22:30:17,901 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.SiteDomain
            22:30:17,905 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.User
            22:30:17,910 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.UserPreferenc es
            22:30:17,915 INFO [Ejb3Configuration] found EJB3 Entity bean: com.frostylabs.es.dirservices.domain.UserSession
            22:30:18,360 INFO [Configuration] Reading mappings from resource: META-INF/orm.xml
            22:30:18,361 INFO [Ejb3Configuration] [PersistenceUnit: dirservices] no META-INF/orm.xml found
            22:30:18,383 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.ContactInfo
            22:30:18,384 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.ContactInfo on table contact_info
            22:30:18,510 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,523 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.Group
            22:30:18,524 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.Group on table groups
            22:30:18,529 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,531 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.Role
            22:30:18,531 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.Role on table roles
            22:30:18,540 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,546 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.SecureRedirec t
            22:30:18,547 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.SecureRedirec t on table secure_redirect
            22:30:18,554 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,556 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.Site
            22:30:18,558 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.Site on table sites
            22:30:18,585 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,587 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.SiteAccess
            22:30:18,587 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.SiteAccess on table site_access
            22:30:18,598 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,607 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.SiteDomain
            22:30:18,616 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.SiteDomain on table site_domains
            22:30:18,681 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,698 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.User
            22:30:18,700 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.User on table users
            22:30:18,705 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,709 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.UserPreferenc es
            22:30:18,721 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.UserPreferenc es on table user_preferences
            22:30:18,726 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:18,728 INFO [AnnotationBinder] Binding entity from annotated class: com.frostylabs.es.dirservices.domain.UserSession
            22:30:18,729 INFO [EntityBinder] Bind entity com.frostylabs.es.dirservices.domain.UserSession on table user_sessions
            22:30:18,774 WARN [AnnotationBinder] Hibernate does not support SequenceGenerator.initialValue()
            22:30:19,265 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceCon nectionProvider
            22:30:19,269 INFO [InjectedDataSourceConnectionProvider] Using provided datasource

            Comment


            • #7
              Console Log ... Continued.

              22:30:19,274 INFO [SettingsFactory] RDBMS: PostgreSQL, version: 7.4.8
              22:30:19,275 INFO [SettingsFactory] JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 7.4.5 JDBC3 with SSL (build 216)
              22:30:19,306 INFO [Dialect] Using dialect: org.hibernate.dialect.PostgreSQLDialect
              22:30:19,307 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransacti onFactory
              22:30:19,314 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerL ookup
              22:30:19,332 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
              22:30:19,333 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
              22:30:19,333 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
              22:30:19,334 INFO [SettingsFactory] JDBC batch size: 15
              22:30:19,334 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
              22:30:19,334 INFO [SettingsFactory] Scrollable result sets: enabled
              22:30:19,334 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
              22:30:19,334 INFO [SettingsFactory] Connection release mode: auto
              22:30:19,334 INFO [SettingsFactory] Default batch fetch size: 1
              22:30:19,335 INFO [SettingsFactory] Generate SQL with comments: disabled
              22:30:19,335 INFO [SettingsFactory] Order SQL updates by primary key: disabled
              22:30:19,335 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
              22:30:19,337 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
              22:30:19,337 INFO [SettingsFactory] Query language substitutions: {}
              22:30:19,338 INFO [SettingsFactory] Second-level cache: disabled
              22:30:19,338 INFO [SettingsFactory] Query cache: disabled
              22:30:19,338 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
              22:30:19,338 INFO [SettingsFactory] Structured second-level cache entries: disabled
              22:30:19,338 INFO [SettingsFactory] Echoing all SQL to stdout
              22:30:19,339 INFO [SettingsFactory] Statistics: disabled
              22:30:19,339 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
              22:30:19,339 INFO [SettingsFactory] Default entity-mode: pojo
              22:30:19,518 INFO [SessionFactoryImpl] building session factory
              22:30:19,977 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
              22:30:19,981 INFO [NamingHelper] JNDI InitialContext properties:{}
              22:30:26,220 INFO [STDOUT] Hibernate: select site0_.id as id44_, site0_.site_type_id as site2_44_, site0_.site_code as site3_44_, site0_.site_label as site4_44_, site0_.site_name as site5_44_, site0_.active_flag as active6_44_ from siteservices.sites site0_ where site0_.site_type_id=? and site0_.active_flag=?
              22:30:30,128 INFO [STDOUT] Hibernate: select nextval ('siteservices.seq_groups')
              22:30:30,416 ERROR [STDERR] after save operation
              22:30:30,417 ERROR [STDERR] group id = 16
              *********************************************

              Comment


              • #8
                Here's another quick update...

                I've changed the BMT to CMT and commented out the following lines in the service.local.xml and i got data to insert in...

                now the question is... what is wrong w/ the following lines...

                <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionM anager">

                <property name="entityManagerFactory" ref="entityManagerFactory" />
                <property name="dataSource" ref="dataSource"/>

                </bean>

                <tx:advice id="serviceTxAdvice" transaction-manager="transactionManager">
                <tx:attributes>
                <tx:method name="*" propagation="REQUIRED" />
                </tx:attributes>
                </tx:advice>

                <aop:config>
                <aopointcut id="serviceMethods" expression="execution(* com.frostylabs.es.dirservices.services.core.impl.* .*Impl* (..))" />
                <aop:advisor advice-ref="serviceTxAdvice" pointcut-ref="serviceMethods" />
                </aop:config>

                I'd would very much like to understand (for learning purposes)... how to get the spring managed transactions to work under a BMT scenario..

                Any help I could get would be appreciated..

                Chris

                Comment


                • #9
                  I think the basic problem you had at the beginning is here:

                  <property name="generateDdl" value="true"/>

                  Can you try to comment it out?

                  PS... You already did. Ignore please.

                  Comment

                  Working...
                  X