I'm currently pulling out my hair with a particular problem...I'm new to the EJB programming space, and wanted to try something 'simple' so here's the situation:
I have 2 entity beans: Employee and Increment. The Employee bean is a CMP bean with 2 fields, ID and Name. The Increment is a rip-off of the sample increment bean that came with Visual Age for Java 4.0, and it basially has 2 persisted fields: Name and count, and 1 business method: increment() that returns the current count and adds 1.
I'm trying to apply the session facade patters to this so I created a SLSB called EmployeeManagerSLSBean and it has a method in it called 'createEmployee(EmployeeVO)' which takes the employee data, gets the next ID from the increment bean, and sets the employee properties of the Employee entity bean. In Visual Age for Java, i created Access Beans for the Increment, Employee, and EmployeeManagerSLS beans. the createEmployee() method uses the Access Beans for Increment and Employee to perform the work of looking up contexts, etc.
The database I am connecting to is MS SQL 2k using the Microsoft JDBC driver found on their website.
I create a test client, which creates an instance of the EmployeeVO that I want to create, and the EmployeeManagerSLSAccessBean that I will use to call createEmployee(). I get the following exception:
Caught Employee Manager Exception.
com.immedient.employee.EmployeeManagerException: There was an exception attempting to create the employee: CORBA TRANSACTION_ROLLEDBACK 0 No; nested exception is:
Here's the transaction properties for each of the beans:
Increment: TX_REQUIRES_NEW -- TRANSACTION_SERIALIZEABLE
Employee: TX_REQUIRED -- TRANSACTION_SERIALIZEABLE
EmployeeManagerSLS TX_REQUIRED -- TRANSACTION_SERIALIZEABLE
I've actually played around with the various transaction isolation and attribures with the EmployeeManagerSLS to be TRANSACTION_READ_COMMITED,etc, but no change..the transaction keeps getting rolled back. However, the Increment bean updates are happening properly in the database, because it is set to TX_REQUIRES_NEW, that update goes through no matter what happens to the other transaction (this is how it should work, and how I want it to work).
A SIMPLER TEST CASE:
I changed the createEmployee() method to not use the IncrementAccessBean at all (commented out the code), and hard coded the ID that i want to use to create the employee. The transaction is STILL rolled back. Aparantly I can't use the EmployeeAccessBean inside a stateless session bean?!!? Has anyone else had this problem? it's KILLING me! Any help is appreciated! Thank you.