You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by docentmail <do...@gmail.com> on 2013/10/29 11:07:12 UTC

OSGi container-managed JPA (4.2.6)doesn’t commit transaction

I'm using OSGi, Karaf 2.3.1 , Hibernate 4.2.6.Final , container-managed JPA
and container-managed JTA. My code doesn't work without flush(). *But after
flush() rollback doesn't work.*

Question is:* Does workaround exist?*

the problem for 4.2.2 was described here Transactions with Hibernate in
Apache Karaf / OSGi Switching to 4.2.6 did not help.

in resent samples I could see flush() as well
https://github.com/hibernate/hibernate-orm/blob/master/documentation/src/main/docbook/quickstart/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java

public void deleteAll() {
   entityManager.createQuery( "delete from DataPoint" ).executeUpdate();
   entityManager.flush();
}
Thank you.

My detailed configuration:
Apache Karaf (2.3.1)
==== Hibernate Bundles 
[ 179] [Active     ] [            ] [       ] [   80]
jackson-datatype-hibernate4 (0)
[ 197] [Active     ] [            ] [       ] [   80]
wrap_mvn_org.hibernate.javax.persistence_hibernate-jpa-2.0-api_1.0.1.Final
(0)
[ 477] [Active     ] [            ] [       ] [   80]
hibernate-commons-annotations (4.0.4.Final)
[ 478] [Active     ] [            ] [       ] [   80] hibernate-core
(4.2.6.Final)
[ 479] [Active     ] [            ] [       ] [   80]
hibernate-entitymanager (4.2.6.Final)
[ 480] [Active     ] [Created     ] [       ] [   80] hibernate-envers
(4.2.6.Final)
[ 481] [Active     ] [            ] [       ] [   80] hibernate-osgi
(4.2.6.Final)

==== Aries Bundles 
[   8] [Active     ] [Created     ] [       ] [   20] Apache Aries Blueprint
Core (1.1.0)
[   9] [Active     ] [Created     ] [       ] [   20] Apache Aries Blueprint
CM (1.0.1)
[  11] [Active     ] [            ] [       ] [   20] Apache Aries Proxy
Service (1.0.1)
[  12] [Active     ] [            ] [       ] [   20] Apache Aries Util
(1.1.0)
[  13] [Active     ] [            ] [       ] [   20] Apache Aries Proxy API
(1.0.0)
[  14] [Active     ] [            ] [       ] [   20] Apache Aries Blueprint
API (1.0.0)
[  24] [Active     ] [            ] [       ] [   30] Apache Aries JMX API
(1.1.0)
[  28] [Active     ] [            ] [       ] [   30] Apache Aries JMX Core
(1.1.1)
[  36] [Active     ] [            ] [       ] [   30] Apache Aries JMX
Blueprint Core (1.1.0)
[  39] [Active     ] [            ] [       ] [   30] Apache Aries JMX
Blueprint API (1.1.0)
[ 160] [Active     ] [            ] [       ] [   30] Aries JPA Container
API (1.0.0)
[ 161] [Active     ] [Created     ] [       ] [   30] Aries JPA Container
blueprint integration for Aries blueprint (1.0.1)
[ 162] [Active     ] [            ] [       ] [   30] Aries JPA Container
(1.0.0)
[ 163] [Active     ] [            ] [       ] [   30] Aries JPA Container
Managed Contexts (1.0.1)
[ 164] [Active     ] [            ] [       ] [   30] Apache Aries JNDI API
(1.0.0)
[ 165] [Active     ] [            ] [       ] [   30] Apache Aries JNDI Core
(1.0.0)
[ 166] [Active     ] [            ] [       ] [   30] Apache Aries JNDI RMI
Handler (1.0.0)
[ 167] [Active     ] [            ] [       ] [   30] Apache Aries JNDI URL
Handler (1.0.0)
[ 168] [Active     ] [            ] [       ] [   30] Apache Aries JNDI
Support for Legacy Runtimes (1.0.0)
[ 338] [Active     ] [Created     ] [       ] [   30] Apache Aries
Transaction Blueprint (1.0.0)
[ 339] [Active     ] [            ] [       ] [   30] Apache Aries
Transaction Manager (1.0.1



--
View this message in context: http://karaf.922171.n3.nabble.com/OSGi-container-managed-JPA-4-2-6-doesn-t-commit-transaction-tp4030094.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: OSGi container-managed JPA (4.2.6)doesn’t commit transaction

Posted by docentmail <do...@gmail.com>.
Thank you  Freeman, 
have switched to hibernate 4.2.7 and issue has been resolved.



--
View this message in context: http://karaf.922171.n3.nabble.com/OSGi-container-managed-JPA-4-2-6-doesn-t-commit-transaction-tp4030094p4030130.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: OSGi container-managed JPA (4.2.6)doesn’t commit transaction

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

This is a known issue[1] get fixed very recently, please use hibernate 4.2.7 which have this fix.

[1]https://hibernate.atlassian.net/browse/HHH-8633


-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋



On 2013-10-29, at 下午6:07, docentmail wrote:

> I'm using OSGi, Karaf 2.3.1 , Hibernate 4.2.6.Final , container-managed JPA
> and container-managed JTA. My code doesn't work without flush(). *But after
> flush() rollback doesn't work.*
> 
> Question is:* Does workaround exist?*
> 
> the problem for 4.2.2 was described here Transactions with Hibernate in
> Apache Karaf / OSGi Switching to 4.2.6 did not help.
> 
> in resent samples I could see flush() as well
> https://github.com/hibernate/hibernate-orm/blob/master/documentation/src/main/docbook/quickstart/tutorials/osgi/managed-jpa/src/main/java/org/hibernate/osgitest/DataPointServiceImpl.java
> 
> public void deleteAll() {
>   entityManager.createQuery( "delete from DataPoint" ).executeUpdate();
>   entityManager.flush();
> }
> Thank you.
> 
> My detailed configuration:
> Apache Karaf (2.3.1)
> ==== Hibernate Bundles 
> [ 179] [Active     ] [            ] [       ] [   80]
> jackson-datatype-hibernate4 (0)
> [ 197] [Active     ] [            ] [       ] [   80]
> wrap_mvn_org.hibernate.javax.persistence_hibernate-jpa-2.0-api_1.0.1.Final
> (0)
> [ 477] [Active     ] [            ] [       ] [   80]
> hibernate-commons-annotations (4.0.4.Final)
> [ 478] [Active     ] [            ] [       ] [   80] hibernate-core
> (4.2.6.Final)
> [ 479] [Active     ] [            ] [       ] [   80]
> hibernate-entitymanager (4.2.6.Final)
> [ 480] [Active     ] [Created     ] [       ] [   80] hibernate-envers
> (4.2.6.Final)
> [ 481] [Active     ] [            ] [       ] [   80] hibernate-osgi
> (4.2.6.Final)
> 
> ==== Aries Bundles 
> [   8] [Active     ] [Created     ] [       ] [   20] Apache Aries Blueprint
> Core (1.1.0)
> [   9] [Active     ] [Created     ] [       ] [   20] Apache Aries Blueprint
> CM (1.0.1)
> [  11] [Active     ] [            ] [       ] [   20] Apache Aries Proxy
> Service (1.0.1)
> [  12] [Active     ] [            ] [       ] [   20] Apache Aries Util
> (1.1.0)
> [  13] [Active     ] [            ] [       ] [   20] Apache Aries Proxy API
> (1.0.0)
> [  14] [Active     ] [            ] [       ] [   20] Apache Aries Blueprint
> API (1.0.0)
> [  24] [Active     ] [            ] [       ] [   30] Apache Aries JMX API
> (1.1.0)
> [  28] [Active     ] [            ] [       ] [   30] Apache Aries JMX Core
> (1.1.1)
> [  36] [Active     ] [            ] [       ] [   30] Apache Aries JMX
> Blueprint Core (1.1.0)
> [  39] [Active     ] [            ] [       ] [   30] Apache Aries JMX
> Blueprint API (1.1.0)
> [ 160] [Active     ] [            ] [       ] [   30] Aries JPA Container
> API (1.0.0)
> [ 161] [Active     ] [Created     ] [       ] [   30] Aries JPA Container
> blueprint integration for Aries blueprint (1.0.1)
> [ 162] [Active     ] [            ] [       ] [   30] Aries JPA Container
> (1.0.0)
> [ 163] [Active     ] [            ] [       ] [   30] Aries JPA Container
> Managed Contexts (1.0.1)
> [ 164] [Active     ] [            ] [       ] [   30] Apache Aries JNDI API
> (1.0.0)
> [ 165] [Active     ] [            ] [       ] [   30] Apache Aries JNDI Core
> (1.0.0)
> [ 166] [Active     ] [            ] [       ] [   30] Apache Aries JNDI RMI
> Handler (1.0.0)
> [ 167] [Active     ] [            ] [       ] [   30] Apache Aries JNDI URL
> Handler (1.0.0)
> [ 168] [Active     ] [            ] [       ] [   30] Apache Aries JNDI
> Support for Legacy Runtimes (1.0.0)
> [ 338] [Active     ] [Created     ] [       ] [   30] Apache Aries
> Transaction Blueprint (1.0.0)
> [ 339] [Active     ] [            ] [       ] [   30] Apache Aries
> Transaction Manager (1.0.1
> 
> 
> 
> --
> View this message in context: http://karaf.922171.n3.nabble.com/OSGi-container-managed-JPA-4-2-6-doesn-t-commit-transaction-tp4030094.html
> Sent from the Karaf - User mailing list archive at Nabble.com.