OK, let me explain more, cause now I think I know what the problem stems
from:
I'm doing:
Object objTxHome = jndiContext.lookup("CCTransactionHome");
CCTransactionHome txHome = (CCTransactionHome)
PortableRemoteObject.narrow(objTxHome, CCTransactionHome.class);
Collection coll = txHome.findBySendBatch();
Iterator it = coll.iterator();
while (it.hasNext()) {
CCTransaction ccTx = (CCTransaction) it.next();
if (ccTx.getFieldX().equals("30")) {
...
} else {
CCTransaction refTx =
txHome.findByPrimaryKey(ccTx.getReferenceTx());
refTx.getFieldY() <-- is coming up null, even when there's
something on the DB
}
}
If all the entities found by the first find have fieldX=30, then this works
fine, but as soon as the !=30 branch gets executed, all hell breaks loose
afterwards, and not even the ==30s work anymore. I wonder if this CAN'T be
done, i.e. invoking another finder on the same home reference that I'm
reading a Collection from. I tried to get a new home reference altogether in
the !=30 branch as in:
if (ccTx.getFieldX().equals("30")) {
...
} else {
Object objTxHome1 = jndiContext.lookup("CCTransactionHome");
CCTransactionHome txHome1 = (CCTransactionHome)
PortableRemoteObject.narrow(objTxHome1, CCTransactionHome.class);
CCTransaction refTx =
txHome.findByPrimaryKey(ccTx.getReferenceTx());
refTx.getFieldY() <-- is coming up null, even when there's
something on the DB
}
...but that doesn't work either (I get nulls, all's a mess afterwards)
Am I missing something? is this a bug or a feature?
Thanks, Luis.
-----Original Message-----
From: Luis Ochoa
Sent: Tuesday, January 30, 2001 2:50 PM
To: '[EMAIL PROTECTED]'
Subject: Finders
Hi again,
Do finders return the whole entity bean, or just part of it?
Let me explain.
I have this code in one of my session beans:
CCTransaction refTx = null;
...
refTx = txHome.findByPrimaryKey(new CCTransactionPK(refTxId));
this works ok, no exceptions thrown (I'm sure, believe me)
now, when I do a:
authStatus = refTx.getAuthTransactionStatus();
and check the value of authStatus, is null, even though I'm looking at the
database, and there's a value there.
I get the result even if I restart the server. Which brings me to: Does
jBoss caches the entities even through server restarts?
Thanks, Luis.
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]