jta

How to obtain JNDI data source for JPA/JTA DAO integration test?

别等时光非礼了梦想. 提交于 2019-12-04 16:06:58
I have a JPA application that has specified JTA transactions in persistence.xml. For whatever reason, I have found that when using JTA, you MUST specify a JNDI data source within persistence.xml as well. This is fine, unless you are trying to go integration testing outside a container and JNDI is not available. My questions are: a) is there anyway to inject a jdbc datasource into my JTA transaction manager? b) if not, how do a handle a JNDI lookup during integration testing? Edit: The error I get when firing up the integration test is: Caused by: org.springframework......

OpenJPA - Transaction management is not available… (Fuse ESB)

﹥>﹥吖頭↗ 提交于 2019-12-04 16:03:08
I'm having trouble with RESOURCE_LOCAL transaction type for JPA in Fuse ESB. I also don't have a complete understanding of whether JTA or RESOURCE_LOCAL is better for me. My persistence.xml : <persistence-unit name="invoicePersistence" transaction-type="RESOURCE_LOCAL"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/invDataSource)</jta-data-source> <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/invDataSource)</non-jta-data-source> <class>com.company

Container Managed Transactions can not rollback

主宰稳场 提交于 2019-12-04 15:49:15
I am playing arround with transactions. I configured JPA to handle my Entitys, and want to persist them in the database. The problem is, CMT will not rollback, when my program throws an runtimeException. The idea behind this "container thing" is so hard to understand and so poorly documented. @transactional managed transactions, pure CDI Interceptor managed transactions and Bean Managed transactions are working like a charm. Here is what I coded: This is a simple "Cinema-Demonstration". you want to see two Movies with X seats. The Seats are limited. If there are not enough seats in Films,

Hibernate JPA with JTA and Glassfish Application Server doesn't seem to commit

和自甴很熟 提交于 2019-12-04 14:43:32
I'm new to hibernate and I want it to use the database connection from the application server via JNDI. The Strange thing is, that it creates my tables in the database but it doesn't save the entity. It seems, that it doesn't commit. Has someone experienced similar problems with hibernate? This is a little test-servlet: public class WriteTest extends HttpServlet { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) { /*try { User user = new User("Hans", "Maulwurf", "hans.maulwurf@test.de"); InitialContext ctx = new InitialContext(); UserFacadeBean bean =

Are XA/JTA transactions still used?

邮差的信 提交于 2019-12-04 13:36:24
问题 I have an application that interacts multiple databases and some custom services. For some operations, I need transaction-like behavior where a set of changes either commit across all databases/services or all roll back if an error occurs. The XA standard from the X/Open group and the Java JTA seem to solve exactly this problem using a two-phase commit process. Some databases (mySQL, Postgres, Oracle) support these interfaces, but I get the feeling that they are not often used or declining in

Failing to merge date on Eclipselink

时光毁灭记忆、已成空白 提交于 2019-12-04 13:08:30
My session bean does not execute an update on a managed entity. I have included code for the classes concerned. When I modify the date field of an event by using a prime faces schedule component and pass the modified entity to a session bean and call em.merge(event) the entity manager does not attempt to update the entity and no changes are registered in the database. Session Bean @Stateless @LocalBean public class CalendarSessionBean implements Serializable { @PersistenceContext private EntityManager em; public void moveEvent (CalendarEvent event) { em.merge(event); Logger.getLogger("example"

How JTA/JTS handle transaction time out issue?

…衆ロ難τιáo~ 提交于 2019-12-04 12:23:43
Below is my understand that JTA/ JTS handle transaction time out issue. But I cannot find my document or material to back my understand. Is my understand right? Do u know any material is refer to this issue? Application Server iterates through all the transactions to check timeout. If a transaction timeout occurs, application server marks roll back for the transaction, and log down the detail. But Application Server neither throws exception nor interrupts the transaction this moment. When the transaction thread continue to attempt to access another transactional resource (like JDBC/ JMS), the

JTA or LOCAL transactions in JPA2+Hibernate 3.6.0?

不打扰是莪最后的温柔 提交于 2019-12-04 12:21:06
问题 We are in the process of re-thinking our tech stack and below are our choices (We can't live without Spring and Hibernate due to the complexity etc of the app). We are also moving from J2EE 1.4 to Java EE 5. Technology stack Java EE 5 JPA 2.0 (I know Java EE 5 only supports JPA 1.0 but we want to use Hibernate as the JPA provider) Hibernate 3.6.0 (We already have lots of hbm files with custom types etc. so we doesn't want to migrate them at this time to JPA. This means we want both jpa/hbm

persistence.xml for multiple persistence units

谁都会走 提交于 2019-12-04 09:19:38
问题 I'm trying to persist the same entity to both MySQL and Postgres databases (this is primarily to identify any inconsistencies, and work out the details of any issues doing the dual-write -- which I've run into here). The articles I've found have all described solutions that depend on additional frameworks. I'm trying to solve this using Glassfish 4.0 out-of-the-box, JPA 2.1 with EclipseLink 2.5 as the JPA provider. I'm using Eclipse, and realize that the IDE doesn't support configuring

Spring JTA TransactionManager config: Supporting both Tomcat and JBoss

折月煮酒 提交于 2019-12-04 08:47:35
问题 I have a web application using JPA and JTA with Spring. I would like to support both JBoss and Tomcat. When running on JBoss, I'd like to use JBoss' own TransactionManager, and when running on Tomcat, I'd like to use JOTM. I have both scenarios working, but I now find that I seem to need two separate Spring configurations for the two cases. With JOTM, I need to use Spring's JotmFactoryBean : <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">