You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Jeongpil An <je...@gmail.com> on 2017/06/29 11:59:56 UTC

Transaction Problem on Hibernate 5

Hi, Karaf Users and Developers! 

I'm using Hibernate 4.3.11 on Karaf 4.0.6, because Hibernate 5.2.0 is not
worked well. 
( It still be same on Karaf 4.1.1 and hibernate 5.2.8) 

It seems that Hibernate 5.2.0 doesn't support  transaction completion on
Karaf 4, in case of  method call between bundles. 
And I'ms using blueprint.xml for transaction settings. 

For Example, Bundle A call Bundle B's Method. 
If Bundle B throws an exception, Bundle B rolled back normally in
CMT(Container Managed Transaction) Mode, but Bundle A doesn't. 

Please share your experiences. 

Thanks in advance. 

-------- My Source Codes ------------ 
--- blueprint.xml (Customer Bundle...)--- 


<?xml version="1.0" encoding="UTF-8"?> 

<blueprint  xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
                        xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0"
            xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

    <jpa:enable/>

..... 
    <reference id="authenticationMgtRef"
interface="com.jbfg.dbp.common.authentication.biz.itf.AuthenticationMgt"/>
    <reference id="accountMgtRef"
interface="com.jbfg.dbp.account.account.biz.itf.AccountMgt"/>

        <service id="customerFinder" ref="customerImpl"
interface="com.jbfg.dbp.customer.customer.biz.itf.CustomerFinder"/>
        <service id="signup" ref="customerImpl"
interface="com.jbfg.dbp.customer.customer.biz.itf.Signup"/>
        <service id="customerMgt" ref="customerImpl"
interface="com.jbfg.dbp.customer.customer.biz.itf.CustomerMgt"/>
        <bean id="customerImpl"
class="com.jbfg.dbp.customer.customer.biz.CustomerImpl" init-method="init">
                <tx:transaction method="*" value="Required"/>
                <property name="authenticationMgt"
ref="authenticationMgtRef"/>
                <property name="accountMgt" ref="accountMgtRef"/>
..... 
    </bean>

</blueprint>
------------------------ 



--CustomerImpl.java--- 
public class CustomerImpl implements CustomerMgt, CustomerFinder, Signup { 

        @PersistenceContext(unitName = "customer") 
        private EntityManager entityManager; 
... 
        private AuthenticationMgt authenticationMgt; 
        private AccountMgt accountMgt; 
..... 
-----------



--
View this message in context: http://karaf.922171.n3.nabble.com/Transaction-Problem-on-Hibernate-5-tp4050882.html
Sent from the Karaf - User mailing list archive at Nabble.com.