I've got a problem with ejipt (v1.2) concerning reentrance and a second
problem with entity bean locking. I have the following scenario:

1 Sessionbean "Alerter"
2 Entitybeans "Alert" and "Message"
1 Entitybean "DistributionPlan"

In Alerter.launchAlert() I create an Alert and a Message object using
container managed transaction. An Alert stores the primary keys from
Message and DistributionPlan as foreign keys. Here are some code snippets
(try/catch removed):

// In Alerter.java
public void launchAlert() throws RemoteException {  // attribute: TX_REQUIRED
    MessageHome mhome = getMessageHome();
    Message m = mhome.create();
    AlertHome ahome = getAlertHome();
    Alert a = ahome.create(selectedPlan, m);
}

// In Alert.java
public BasePK ejbCreate(DistributionPlan dp, Message msg) throws
RemoteException, CreateException {
    super.ejbCreate();
    this.dp = dp;       // store the references to objects for further use
    this.msg = msg;

    dpkey = (dp != null) ? ((BasePK) dp.getThePrimaryKey()).key : null;
// copy the primary keys to local members for container managed persistence
    msgkey = (msg != null) ? ((BasePK) msg.getThePrimaryKey()).key : null;

    return null;
}

public void ejbStore() throws RemoteException {
    super.ejbStore();
    dpkey = (dp != null) ? ((BasePK)dp.getThePrimaryKey()).key : null;

    msgkey = (msg != null) ? ((BasePK)msg.getThePrimaryKey()).key : null;

}

getThePrimaryKey() is a business method that does the same as
getPrimaryKey(). I use it to show the problems that I ran into with a much
more complicated code. Two strange things happen:

a) The code as stated above throws a "bean not reentrant" exception when
trying to call the business method getThePrimaryKey() the second time. This
is not in a loopback, but these are two sequential calls. I have to make
the bean reentrant to not get the exception.

b) After the container commits the transaction, the DistributionPlan entity
bean still is locked within ejipt (not in the database). DistributionPlan
is the object that isn't altered in the code at all, simply read from a
table of the database and never written back. If I change the code so the
underlying database is altered, the object get's properly unlocked.

Has anyone an idea what is going wrong here? All examples I found always
used 1 session bean acting with 2 or more entity beans and the entity beans
didn't call each other.

Thanks for any help, Reiner

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to