A JavaEE application is deployed on Tomee v8.0.16, without using the spring framework. Eclipselink v2.7.13 is used as an ORM. The connection settings are specified in the server.xml file
<GlobalNamingResources>
<Resource name="testdb" auth="Container" type="javax.sql.DataSource"
username="test" password="testPassord"
url="jdbc:postgresql://localhost:5432/postgres"
driverClassName=".postgresql.Driver"
initialSize="5"
maxWaitMillis="1200000"
maxTotal="120"
maxIdle="10"
validationQuery="select 1"
removeAbandonedTimeout="120"
removeAbandonedOnBorrow="true"
logAbandoned="true"
/>
</GlobalNamingResources>
When creating obj1, a transaction is opened and perform persist.
utx.begin();
em.persist(obj1)
A second obj2 is created by a foreign key linked to obj1. All fields are filled in it except for one required one, in order to cause an exception. Similarly perform persist.
em.persist(obj1)
and finally make a commit
utxmit();
Accordingly, an exception occurs, rollback is done. Ideally, both objects should fall under rollback and not be saved in the database, but for some reason obj1 was saved in the database.
PS: Initially, the application was deployed in weblogic and there were no such problems. Maybe there are some additional settings in tomcat?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744195948a4562657.html
评论列表(0条)