Environment: Websphere 5, EJB 2.0, stateless EJBs for declarative transaction demarcation, DB2, Hibernate 2.1.3.
I have a single database with tables from a previous project using CMP-EJBs.
In my new project I would like to use Hibernate to access the database, but with completely new tables.
All old data in the old tables will still be access via the CMP-EJBs.
The new application may sometimes need to access the old tables in order to read old data.
After that data may be written to one of the new tables using Hibernate. Like this:
Code:
class EJBFacade {
public void moveData { // transaction declared as REQUIRED
data = readOldDataWithCMP(); // (1)
saveAsNewDataWithHibernate(data); // (2)
}
}
Since we have a known problem with our IBM JDBC-driver (it does not handle 2PC) I want to use the same
datasource for both CMPs and Hibernate.
If I comment out either of the statements (1) or (2) the other will function as expected in isolation.
But when I try to run them in sequence I cannot get this to work...
The first access to the database (1) goes fine, data is retrieved.
But when Hibernate (2) tries to associate with the transaction the following mewssage is output:
An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
But I am only using a single datasource!
Any ideas on how I may get this to work?