M
Mick Willis
I am having trouble mixing calls to BMP and CMP entity beans within
the same method call in a session bean.
I have a number of CMP beans but I needed to create one BMP bean in
order to implement some Oracle specfic SQL code (using XMLType CLOB).
However, as the BMP needed to obtain its own connection an error was
throw which indicates that two connections are not allowed within the
transaction without resorting to XA datasource for 2 phase commit. I
don't want to do this.
I have tried changing the session bean to be "bean managed" trasaction
and this allows the BMP to be called successfully, but then a
subsequent calls to CMP beans results in a
java.lang.IllegalStateException. Code snipit below:
// ScheduleTaskLocal is a CMP
ScheduleTaskLocal schTk = (ScheduleTaskLocal) i.next();
System.out.println("Schedule Task # " + schTk.getPrimaryKey());
// get schedule run details (this is BMP bean)
ScheduleRunDetailLocal taskDet = null;
try {
taskDet = getScheduleRunDetailHome().findByPrimaryKey(
new ScheduleRunDetailKey((Integer) schedRun.getPrimaryKey(),
(Integer) schTk.getPrimaryKey()));
} catch (FinderException e) {
// not been started yet so check for dependancies
Collection tkDepCol = schTk.getTaskdependancy();
Iterator tkIter = tkDepCol.iterator(); // <-- error here with
IllegalStateException
....
Any ideas or people with similar problems. Thanks in advance.
the same method call in a session bean.
I have a number of CMP beans but I needed to create one BMP bean in
order to implement some Oracle specfic SQL code (using XMLType CLOB).
However, as the BMP needed to obtain its own connection an error was
throw which indicates that two connections are not allowed within the
transaction without resorting to XA datasource for 2 phase commit. I
don't want to do this.
I have tried changing the session bean to be "bean managed" trasaction
and this allows the BMP to be called successfully, but then a
subsequent calls to CMP beans results in a
java.lang.IllegalStateException. Code snipit below:
// ScheduleTaskLocal is a CMP
ScheduleTaskLocal schTk = (ScheduleTaskLocal) i.next();
System.out.println("Schedule Task # " + schTk.getPrimaryKey());
// get schedule run details (this is BMP bean)
ScheduleRunDetailLocal taskDet = null;
try {
taskDet = getScheduleRunDetailHome().findByPrimaryKey(
new ScheduleRunDetailKey((Integer) schedRun.getPrimaryKey(),
(Integer) schTk.getPrimaryKey()));
} catch (FinderException e) {
// not been started yet so check for dependancies
Collection tkDepCol = schTk.getTaskdependancy();
Iterator tkIter = tkDepCol.iterator(); // <-- error here with
IllegalStateException
....
Any ideas or people with similar problems. Thanks in advance.