Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Eclipselink JPA not committing on persist/merge

393585Mar 31 2011 — edited Mar 31 2011
Hi,

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();
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2011
Added on Mar 31 2011
1 comment
2,193 views