OK, mistake in my previous post. It's actually (on the else branch):

CCTransaction refTx = txHome.findByPrimaryKey(new
CCTransactionPK(ccTx.getReferenceTx()));

What I have is a table with an integer  field (referenceTx) that refers to
the same table. So basically I'm looking up records that meet a certain
criteria (findBySendBatch) and then, for each one of them, I'm testing if
the field txCode is 30. If it isn't, that means that they have a reference
(again in referenceTx, an integer) to another record in the table. So at
that point, I get another CCTransaction refTx = txHome.findByPrimaryKey(new
CCTransactionPK(ccTx.getReferenceTx())); and that is what's blowing the
server up, not literally, but giving me values inconsistent with what the
database holds. So again, this is how the code looks:

Object objTxHome = jndiContext.lookup("CCTransactionHome");
CCTransactionHome txHome = (CCTransactionHome)
PortableRemoteObject.narrow(objTxHome, CCTransactionHome.class);
Collection coll = txHome.findBySendBatch(); //group of rows that meet the
"SendBatch" criteria
Iterator it = coll.iterator();
while (it.hasNext()) { //loop through the collection
        CCTransaction ccTx = (CCTransaction) it.next();
        if (ccTx.getFieldX().equals("30")) {
                ...  //all works good as long as all the records go through
this branch
        } else {
                //same home interface as the findBySendBatch, just now
findByPrimaryKey, should give me another row in the table
                CCTransaction refTx = txHome.findByPrimaryKey(new
CCTransactionPK(ccTx.getReferenceTx()));
                String foo = refTx.getFieldY(); // is coming up null, even
when there's something on the DB
        }
}

Sorry for the earlier mix-up, I guess I have to be really accurate in what I
post if I expect anyone to help me. :-)

Thanks, Luis.

-----Original Message-----
From: Ingo Bruell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 31, 2001 5:28 AM
To: jboss-user
Subject: Re: [jBoss-User] RE: Finders


> 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
> }
> }

It is not possible to find an EntityBean with a reference.

Is ccTx != ccTx.getReferenceTx() ?




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to