jta

Using arbitrary resources with JTA

荒凉一梦 提交于 2020-01-12 09:53:11
问题 Is it possible to make any type of custom resource transactioal with JTA? Let's assume a basic example and take a Folder creation that should be rolled back in case of an error. Can such custom resources be handled? 回答1: Yes. That resource needs to provide an implementation of XAResource, and an instance of that implementation needs to be enlisted with the transaction when the resource is used. The resource can get the current transaction from the transaction manager in order to carry out the

org.apache.openjpa.persistence.EntityExistsException in jpa

不想你离开。 提交于 2020-01-07 06:37:11
问题 I have a JTA transcation which manages transaction of 2 databases A and B.Now inside jta transcation i have a method that return a entity from db A.How i want to set some different values to some primary key (primary key is composit primary key) and then persist the entity as a new record.But am getting following exception: <openjpa-1.2.2-SNAPSHOT-r422266:778978M-OPENJPA-975 nonfatal store error> org.apache.openjpa.persistence.EntityExistsException: Attempt to persist detached object "xyz.abc

HK2 Jersey EJB 3 injection

廉价感情. 提交于 2020-01-06 11:48:09
问题 I followed the 22.1. Implementing Custom Injection Provider paragraph https://jersey.java.net/documentation/latest/user-guide.html#deployment I was able to develop my own injectable custom annotation following the steps described in this post: Jersey 2.x Custom Injection annotation NULL So i use these deployment instructions to bind my injectionresolver: <servlet> <servlet-name>Jersey REST Service</servlet-name> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

My EJB throws a transaction required exception although another EJB setup in the same way with same persistence unit throws no excpetion

随声附和 提交于 2020-01-06 07:16:33
问题 First here is my entire EJB file: package enkia.pulse.indexing.beans; import enkia.pulse.core.Category; import enkia.pulse.core.Product; import enkia.pulse.core.Review; import enkia.pulse.core.Twitter; import enkia.utils.HarvestingConstants; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Resource; import javax.ejb.SessionContext; import javax.ejb

When should I use `REQUIRED` vs `NOT_SUPPORTED` as a the value of @TransactionAttribute for an MDB?

故事扮演 提交于 2020-01-04 08:03:14
问题 I know about container managed transactions(CMT). I also know about the different possible values of the enumerated type TransactionAttributeType . Since the client never calls a MDB directly, the attribute types other than the REQUIRED and NOT_SUPPORTED do not make sense for MDB's as there is no client initiated transaction to join to. So when should I annotate the onMessage() method of an MDB with REQUIRED vs NOT_SUPPORTED ? What will be the default behavior in none of the two options is

Transaction fails with IJ000457, IJ000461 and IJ000356 on first time, but works thereafter

Deadly 提交于 2020-01-01 17:11:13
问题 I am trying to run JSF application with JPA on Wildly server, I have the following code, there is an exception when trying to add employee at first time, but when trying another time, it works fine, I did not find the reason, please help. session bean: import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContextType;

How to kill db transaction that timed out from jboss

二次信任 提交于 2020-01-01 14:29:26
问题 I use jboss 4.2.3. It has setting "TransactionTimeout" (in jboss-service.xml), that specifies how long Transaction is allowed to execute. Unfortunately, when the timeout passes, the execution isn't aborted right now, if the transaction is doing something, only it is marked to be rolled back later. The effect is - when I have long lasting transaction and thread is wainting on preparedStatement.execute for example, and when the TransactionTimeout passes, nothing happend, client still hang, only

Object is not getting persisted using JPA/JTA/JBOSS/CDI

老子叫甜甜 提交于 2019-12-31 04:07:07
问题 Please help me to understand why object is not getting persisted with following code. It throws javax.persistence.TransactionRequiredException: JBAS011469: Transaction is required to perform this operation (either use a transaction or extended persistence context) public class OrganizationRepositoryImpl implements OrganizationRepository { @PersistenceContext(unitName="usermanagement",type=PersistenceContextType.TRANSACTION) private EntityManager em; public void save(Organization organization)

事务模型

我的未来我决定 提交于 2019-12-26 20:57:10
3种事务模型 本地事务模型 本地事务模型的名称来自于它实际上不是管理事务的框架,而是本地资源管理器。资源管理器是与之通信的数据源的实际提供者。例如,对于数据库,资源管理器是通过数据库驱动程序和DBMS实现的。对于JMS,资源管理器是通过特定的JMS提供程序实现的队列(或主题)连接工厂。使用本地事务模型,开发人员管理连接,而不是事务。实际管理本地事务的是DBMS或JMS提供程序。关于本地事务, 事实是事务管理由底层数据库(DBMS)处理,如果是jms,则由底层消息传递提供程序处理。从开发人员的角度来看,我们不管理本地事务模型中的事务,而是管理连接 。下面的代码示例演示了使用直接JDBC代码的本地事务模型的使用: public void updateTradeOrder(TradeOrderData order) throws Exception { DataSource ds = (DataSource) (new InitialContext()).lookup( "jdbc/MasterDS"); Connection conn = ds.getConnection(); conn.setAutoCommit(false); Statement stmt = conn.createStatement(); String sql = "update trade_order ...

Hibernate 5 HQL translator for Oracle Spatial

♀尐吖头ヾ 提交于 2019-12-25 10:02:28
问题 I am upgrading an application from Hibernate 3.6.10.Final to 5.0.7.Final The main issue I have right now is that when before the Oracle dialect would generate a fast enough query like this : SELECT * FROM MY_TABLE WHERE SDO_RELATE(geom,SDO_GEOMETRY(?,4326),'mask=INSIDE+COVEREDBY') ='TRUE' Now it will generate something terribly slow: SELECT * FROM MY_TABLE WHERE MDSYS.OGC_WITHIN(MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(geom),MDSYS.ST_GEOMETRY.FROM_SDO_GEOM(?))=1 This one will not finish on time and