jta

How to adapt persistence.xml file to connect JPA to a JDBC/MySQL database in Java EE environment (Tomcat + JSF)

我只是一个虾纸丫 提交于 2019-12-01 06:30:05
I am developing a Dynamic web project (Java EE) using JSF, PrimeFaces, JPA, and running on Tomcat 7. The project development is based on http://www.simtay.com/simple-crud-web-application-with-jsf-2-1-primefaces-3-5-maven-and-jpa/ Now I am developing the JPA part of the software. In past, when I developed some little things (as exercises) in Java SE, I used to use the following database properties: jdbc.drivers=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8 jdbc.username=root jdbc.password=password But now I am learning JPA on Java EE. In

Spring / JTA / JPA unit test : Rollback not working

你说的曾经没有我的故事 提交于 2019-12-01 05:59:11
I am trying to test an entity EJB3 with Spring. The EJB itself does not uses Spring and I would like to keep duplications of the production JPA configuration minimal (ie not duplicating persistence.xml for exemple). My unit tests seems to work but even though my unit tests should be transactionnal, data is persisted between the various test methods ... Here is my entity : package sample; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Ejb3Entity { public Ejb3Entity(String data) { super(); this.data = data; } private

Overriding global jta timeout in spring context in weblogic

亡梦爱人 提交于 2019-12-01 05:58:00
Our Weblogic have global JTA timeout 30s, since our server is under high load setting such global timout to a bigger value can be critical for performace of the application. So I want to override this JTA timeout with specific value in context of particular service. I have root context for a number of webservices it has it's own global transaction manager: <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager"> <property name="transactionManagerName" value="javax.transaction.TransactionManager"/> </bean> annotation driven for this transation

How to adapt persistence.xml file to connect JPA to a JDBC/MySQL database in Java EE environment (Tomcat + JSF)

不打扰是莪最后的温柔 提交于 2019-12-01 04:29:55
问题 I am developing a Dynamic web project (Java EE) using JSF, PrimeFaces, JPA, and running on Tomcat 7. The project development is based on http://www.simtay.com/simple-crud-web-application-with-jsf-2-1-primefaces-3-5-maven-and-jpa/ Now I am developing the JPA part of the software. In past, when I developed some little things (as exercises) in Java SE, I used to use the following database properties: jdbc.drivers=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/test?useUnicode=true

How do I mock a TransactionManager in a JUnit test, (outside of the container)?

自古美人都是妖i 提交于 2019-12-01 03:12:44
I'm using Spring 3.1.0.RELEASE, JUnit 4.8.1, and ultimately deploying my application to a JBoss 4.2 server (I know, I know). As part of setting up my unit test, I have this in my Spring test application context ... <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransactionName"> <value>UserTransaction</value> </property> </bean> Of course, right now this fails because there is nothing bound to the JNDI name, "UserTransaction." How do I mock a transaction manager? I'm using the org.mockejb framework but an open to any

In JBoss/WildFly should I enable JTA on data source to use with JPA?

China☆狼群 提交于 2019-11-30 23:41:39
In JBoss/WildFly, when configuring a data source, there is a JTA option, which is disabled by default: <datasource jta="false" jndi-name="java:/wt/testds" pool-name="testds" enabled="true" use-ccm="false"> ... </datasource> Now I want to associate this data source with JPA using JTA transaction type: <?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">

Can I exclude an exported package from a Java module?

血红的双手。 提交于 2019-11-30 20:26:43
Modules jta and java.sql export package javax.transaction.xa to module dom4j As you can see, both modules jta and java.sql export the same package, javax.transaction.xa . However, the package in jta has classes that I require that are not present in java.sql . I would simply not require the java.sql module, but I need java.sql.SQLException . Is it possible to prevent java.sql from exporting javax.transaction.xa ? The JTA GitHub reads the following in confirmation to what @Alan already pointed out in a comment - This standalone release of Java(TM) Java Transaction API (JTA), uses a Java

好程序员Java学习路线分享JavaEE的13种核心技术

半世苍凉 提交于 2019-11-30 19:01:11
好程序员Java学习路线分享JavaEE的13种核心技术,JavaEE是J2EE的一个新的名称,之所以改名,目的还是让大家清楚J2EE只是Java企业应用。许多朋友想要通过掌握好JavaEE的技术,方便自己以后在企业中成为一名优秀的Java架构师,那么JavaEE都有哪些核心技术呢? JavaEE平台由一整套服务、应用程序接口和协议构成,它对开发基于Web的多层应用提供了功能支持。   下面是对JavaEE中的13种技术规范的简单描述: 1、JDBC(JavaDatabaseConnectivity) JDBC API为访问不同的数据库提供了一种统一的途径,象ODBC一样,JDBC对开发者屏蔽了一些细节问题,另外JDCB对数据库的访问也具有平台无关性。 2、JNDI(JavaNameandDirectoryInterface) JNDI API被用于执行名字和目录服务。它提供了一致的模型来存取和操作企业级的资源如DNS和LDAP,本地文件系统,或应用服务器中的对象。 3、EJB(EnterpriseJavaBean) Java EE技术之所以赢得媒体广泛重视的原因之一就是EJB。它们提供了一个框架来开发和实施分布式商务逻辑,由此很显著地简化了具有可伸缩性和高度复杂的企业级应用的开发。EJB规范定义了EJB组件在何时如何与它们的容器进行交互作用。容器负责提供公用的服务,例如目录服务

In JBoss/WildFly should I enable JTA on data source to use with JPA?

主宰稳场 提交于 2019-11-30 18:04:32
问题 In JBoss/WildFly, when configuring a data source, there is a JTA option, which is disabled by default: <datasource jta="false" jndi-name="java:/wt/testds" pool-name="testds" enabled="true" use-ccm="false"> ... </datasource> Now I want to associate this data source with JPA using JTA transaction type: <?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:/

Difference between JTA and Spring @Transactional annotations

走远了吗. 提交于 2019-11-30 15:07:55
问题 I've been starting to use Spring's @Transactional annotation, and it provides a lot of convenience for managing transactions. However, using this annotation in our code now makes us dependent on Spring. I know with JPA type stuff there is a javax persistence package where we can mark up the code with all sorts if JPA annotations, but since they all come from javax.persistence , our code isn't dependent on any specific implementation or ORM. I guess my question is if there are any similar