Eclipselink JPA not committing on persist/merge
393585Mar 31 2011 — edited Mar 31 2011Hi,
Here is my environment. Both jar files are also working since the read portion of the transactions work.
WL 10.3.3
EclipseLink 2.2
Oracle 11G DB
EJB3 -> DAO
I am able to read the data from the database using the persistence.xml below. However, when I change values in the object, it goes through the persist code without error, but nothing commits. I am obviously missing the transactional demarcation that is needed for the commit. I want to use CMT, but I want to know where my definition is lacking.
Am I missing a property in the persistence.xml file? Should my EJB be declared differently?
Thanking you in advance
SO
Here are the snippets
1. Persistence.xml
<persistence-unit name="DDD" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>jdbc/myds</non-jta-data-source>
<class>common.persistence.BaseEntity</class>
<class>persistence.user.Users</class>
...
</persistence-unit>
2. EJB3 test call to the DAO
Users user = beanValue.getById(new Long(1));
System.out.println(user);
user.setFirstName("Joe");
user.setLastName("Morgan");
beanValue.saveUser(user);
3. saveUser method
@TransactionAttribute(TransactionAttributeType.REQUIRED) )
getEntityManager().merge(user); OR
getEntityManager().persist(user);
4. EJB3 declaration
@Stateless(mappedName="UserBean")
@TransactionManagement(TransactionManagementType.CONTAINER)
public class UserBean implements User
5. EMFactory/EM creation
return emFactory.createEntityManager();