🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: weblogic.developer.interest.ejb
Article #5

Combining BMP and CMP within a Transaction in a session bean (facade)

#5
From: Mick Willis
Date: Wed, 03 Sep 2003 12:19
39 lines
2542 bytes
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.
Technical Details
Message-ID: <60bca77f.0309030419.7ce46d6e@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10a146,25efbc4878ecf26a,start
X-Google-Attributes: gid10a146,public
X-Google-Thread: 11519f,25efbc4878ecf26a,start
X-Google-Attributes: gid11519f,public
X-Google-Thread: fcfb6,25efbc4878ecf26a,start
X-Google-Attributes: gidfcfb6,public
X-Google-ArrivalTime: 2003-09-03 05:19:37 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: Mick.Willis@ubs.com (Mick Willis)
Newsgroups: weblogic.developer.interest.ejb,ibm.software.websphere.application-server.as400,comp.lang.java.programmer
Subject: Combining BMP and CMP within a Transaction in a session bean (facade)
Date: 3 Sep 2003 05:19:36 -0700
Organization: http://groups.google.com/
Lines: 39
Message-ID: <60bca77f.0309030419.7ce46d6e@posting.google.com>
NNTP-Posting-Host: 165.222.186.194
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1062591577 19809 127.0.0.1 (3 Sep 2003 12:19:37 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 3 Sep 2003 12:19:37 GMT