faehne
2014-03-26 07:36:43 UTC
Hi,
i'm doing some db-updates via OpenJPA, that are not written to DB (but TRACE
shows the sql-update and the commit).
Only on Server shutdown it will be written to DB.
The call-hierarchie is:
request-scoped jsfbean --> select entitybean --> ejb-call with enitybean as
param --> em.merge
Here are my code and config:
----------------------------------------
EJB:
----------------------------------------
@Stateless
public class UserServiceBean implements UserService {
@PersistenceContext(unitName="AmePersistenceUnit")
EntityManager entityManager;
...
@Override
public User update(User obj) {
System.out.println("===========================UPDATE
START=========================");
User usr = entityManager.merge(obj);
entityManager.flush();
System.out.println("===========================UPDATE
END=========================");
return usr;
}
...
}
----------------------------------------
perstistence.xml:
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="AmePersistenceUnit" transaction-type="JTA">
<description>Persistence Unit fuer die AmeEnities</description>
<jta-data-source>DS</jta-data-source>
<class>xxx.User</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE,
Tool=TRACE, SQL=TRACE"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
</properties>
</persistence-unit>
</persistence>
----------------------------------------
managed bean (JSF):
----------------------------------------
public class Testing {
@EJB(name="...")
private AmeUserService userService;
public void test()
{
System.out.println("==================== START Testing
===================");
User user = users.get(0);
System.out.println(user.getName());
user.setVersuche(0);
user.setLoggedIn("J");
userService.update(user);
System.out.println("==================== STOP Testing
===================");
}
}
--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/No-Commit-to-DB-on-JSF-EJB-OpenJPA-tp3987752.html
Sent from the Users mailing list archive at Nabble.com.
i'm doing some db-updates via OpenJPA, that are not written to DB (but TRACE
shows the sql-update and the commit).
Only on Server shutdown it will be written to DB.
The call-hierarchie is:
request-scoped jsfbean --> select entitybean --> ejb-call with enitybean as
param --> em.merge
Here are my code and config:
----------------------------------------
EJB:
----------------------------------------
@Stateless
public class UserServiceBean implements UserService {
@PersistenceContext(unitName="AmePersistenceUnit")
EntityManager entityManager;
...
@Override
public User update(User obj) {
System.out.println("===========================UPDATE
START=========================");
User usr = entityManager.merge(obj);
entityManager.flush();
System.out.println("===========================UPDATE
END=========================");
return usr;
}
...
}
----------------------------------------
perstistence.xml:
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="AmePersistenceUnit" transaction-type="JTA">
<description>Persistence Unit fuer die AmeEnities</description>
<jta-data-source>DS</jta-data-source>
<class>xxx.User</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=TRACE, Runtime=TRACE,
Tool=TRACE, SQL=TRACE"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
</properties>
</persistence-unit>
</persistence>
----------------------------------------
managed bean (JSF):
----------------------------------------
public class Testing {
@EJB(name="...")
private AmeUserService userService;
public void test()
{
System.out.println("==================== START Testing
===================");
User user = users.get(0);
System.out.println(user.getName());
user.setVersuche(0);
user.setLoggedIn("J");
userService.update(user);
System.out.println("==================== STOP Testing
===================");
}
}
--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/No-Commit-to-DB-on-JSF-EJB-OpenJPA-tp3987752.html
Sent from the Users mailing list archive at Nabble.com.