karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Soto <alex.s...@envieta.com>
Subject Re: MariaDB/JPA Transaction rollback not working
Date Wed, 16 May 2018 19:08:37 GMT
Yes, same result.  I even tried with Narayana Transaction Manager, and same result.

Best regards,
Alex soto




> On May 16, 2018, at 2:56 PM, Jean-Baptiste Onofré <jb@nanthrax.net> wrote:
> 
> Same behavior with RequiresNew ?
> 
> Regards
> JB
> 
> On 16/05/2018 19:44, Alex Soto wrote:
>> With Karaf version 4.2.0, Rollback is not working with MariaDB and InnoDB tables.
>> I deployed these features (from Karaf’s enterprise  repository):
>> <feature>aries-blueprint</feature>
>> <feature>transaction</feature>
>> <feature>jndi</feature>
>> <feature>jdbc</feature>
>> <feature>jpa</feature>
>> <feature>pax-jdbc-mariadb</feature>
>>         <feature>pax-jdbc-config</feature>
>> <feature>pax-jdbc-pool-dbcp2</feature>
>> <feature>hibernate</feature>
>> My Data Source is configured in the file /org.ops4j.datasource-responder.cfg/
>>    osgi.jdbc.driver.name = mariadb
>>    dataSourceName=responder
>>    url
>>    = jdbc:mariadb://mariadb.local:3306/responder?characterEncoding=UTF-8&useServerPrepStmts=true&autocommit=false
>>    user=XXXX
>>    password=XXXX
>>    databaseName=responder
>>    #Pool Config
>>    pool=dbcp2
>>    xa=true
>> My persistence.xml:
>>    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>    http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
>>             <persistence-unit name="responderPersistenUnit" transaction-type="JTA">
>>                 <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
>>             <!-- Only used when transaction-type=JTA -->
>>                 <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=responder)</jta-data-source>
>>             <!-- Only used when transaction-type=RESOURCE_LOCAL -->
>>                 <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=responder)</non-jta-data-source>
>>             <properties>
>>                     <property name=“hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"
/>
>>                 <property name="hibernate.show_sql" value="true" />
>>                 <property name="hibernate.format_sql" value="true" />
>>                 <property name="hibernate.hbm2ddl.auto" value="none"/>
>>             </properties>
>>         </persistence-unit>
>>    </persistence>
>> My blueprint.xml:
>>    <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/v2.0.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 />
>>    <tx:enable />
>>    <bean id="userService" class="org.data.impl.UserServiceImpl" />
>>    <service ref="userService" interface="org.data.UserService" />
>>    </blueprint>
>> For testing I throw exception in my DAO:
>> @Transactional(REQUIRED)
>> public void addUser(User user) {
>> em.persist(user);
>> em.flush();
>> throw new RuntimeException("On Purpose");
>> }
>> I expect the record not to be in the table due to rollback of the transaction, but
it still shows up in my database table.
>> Best regards,
>> Alex soto


Mime
View raw message