jta

JPA with JTA: Persist entity and merge cascaded child entities

不想你离开。 提交于 2019-11-28 07:00:06
问题 I have a bidirectional one-to-many relationship with the following entity classes: 0 or 1 client <-> 0 or more product orders When persisting the client entity I want the associated product order entities to be persisted, too (as their foreign key to the "parent" client may have been updated). Of course all required CASCADE options are set on the client side. But it does not work if a newly created client is persisted for the first time while referencing an existing product order as in this

How does UserTransaction propagate?

左心房为你撑大大i 提交于 2019-11-28 06:29:44
I have a stateless bean with bean-managed transactions, and a method like this: @Stateless @TransactionManagement(TransactionManagementType.BEAN) public class ... { @Resource private UserTransaction ut; @EJB private OtherStatelessBeanLocal other; public void invokeSomeMethods() ut.begin(); ... // invoke other bean's methods here. other.method(); ... ut.commit(); } } So how does the UserTransaction propagate to the OtherStatelessBeanLocal bean? The UserTransaction object is an object supplied by the container which wraps access to API calls that the container uses internally, specifically javax

JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()

寵の児 提交于 2019-11-28 05:32:35
问题 Using hibernate in my application, and everytime I do a transaction, I get this warning. It is spamming my logs. JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession() I think it is caused by hibernate.current_session_context_class property. <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property> <property name="hibernate.connection.pool_size">5<

Configuring EJB on JBoss AS 7 using JTA datasources: every statement is commited

十年热恋 提交于 2019-11-28 01:48:21
问题 everybody! I've been trying to find the answer for some time but I didn't manage. I try to configure my application and make it work under JBoss Application Server 7.1.1, using Enterprise Java Beans. My application is Web application, it uses servlets and injects other classes as EJBs. The problem is that every statement gets commited, so that means no transaction management is supported. In my test example I have an entity with a collection of children (mapped with a relationship OneToMany

javax.persistence.PersistenceException - JPA+Hibernate

杀马特。学长 韩版系。学妹 提交于 2019-11-27 23:23:20
I am new to JPA, when I tried to run the following code, it showing error as " cvc-elt.1: Cannot find the declaration of element 'persistence'. " I cant able to fix this error, could u pls help me out to solve this issue. Cheers Rajesh Persistance.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="jpa" transaction-type="JTA">

How to manage transaction for database and file system in Java EE environment?

99封情书 提交于 2019-11-27 20:34:58
问题 I store file’s attributes (size, update time…) in database. So the problem is how to manage transaction for database and file. In a Java EE environment, JTA is just able to manage database transaction. In case, updating database is successful but file operation fails, should I write file-rollback method for this? Moreover, file operation in EJB container violates EJB spec. What’s your opinion? 回答1: Access to external resources such as a file system should ideally go through a JCA connector .

hibernate, mysql, glassfish v3, and JTA datasource

懵懂的女人 提交于 2019-11-27 18:13:11
问题 I'm attempting to use hibernate entity manager with mysql and glassfish. I'm getting the following error when attempting to use a JTA datasource: Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:376) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1367) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory

Atomikos vs JOTM vs Bitronix vs? [closed]

旧街凉风 提交于 2019-11-27 17:36:39
I am new to JTA and it's underlying transaction managers. Can anyone explain the pros/cons of each of these? Feel free to add others I didn't list in title. Also, don't the major applications servers (WebSphere, JBoss, Glassfish) have their own JTA compliant transaction manager? In those environments, would you still use these third party implementations? Pascal Thivent I am new to JTA and it's underlying transaction managers. Can anyone explain the pros/cons of each of these? Feel free to add others I didn't list in title. Standalone transaction managers I'm aware of include Bitronix ,

Spring Boot的启动器Starter详解

↘锁芯ラ 提交于 2019-11-27 17:31:20
Spring Boot的启动器Starter详解 Spring Boot应用启动器基本的一共有 44 种,具体如下: 1) spring-boot-starter 这是Spring Boot的核心启动器,包含了自动配置、日志和YAML。 2)spring-boot-starter-actuator 帮助监控和管理应用。 3)spring-boot-starter-amqp 通过spring-rabbit来支持AMQP协议(Advanced Message Queuing Protocol)。 4)spring-boot-starter-aop 支持面向方面的编程即AOP,包括spring-aop和AspectJ。 5)spring-boot-starter-artemis 通过Apache Artemis支持JMS的API(Java Message Service API)。 6) spring-boot-starter-batch 支持Spring Batch,包括HSQLDB数据库。 7)spring-boot-starter-cache 支持Spring的Cache抽象。 8)spring-boot-starter-cloud-connectors 支持Spring Cloud Connectors,简化了在像Cloud Foundry或Heroku这样的云平台上连接服务。

Cannot inject RESOURCE_LOCAL container managed EntityManager using @PersistenceContext

徘徊边缘 提交于 2019-11-27 16:11:32
问题 I am using JBoss AS 7.1.1 and able to configure a new JTA datasource and wire it to my EJB using @PersistenceContext(unitName="TestPU") private EntityManager entityManager; When I tried to use RESOURCE_LOCAL PersistenceUnit I am getting the error saying I can't inject RESOURCE_LOCAL PU using @PersistenceContext. I have configured my persistence.xml as follows: <persistence-unit name="TestPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider>