Well, I'll be darned. After doing what you say below, I could see what jboss
was retrieving from the database, and even though the PK was the same for
the context and the bean, a lot of fields that were populated in the DB,
were coming up null in ejbLoad. So I replaced the older classes111.zip
oracle jdbc drivers, with the latest classes12.zip, and everything started
to work fine. I guess the old drivers were the culprit.

Thanks,Luis.

-----Original Message-----
From: Ole Husgaard [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 01, 2001 4:28 AM
To: jBoss
Subject: Re: [jBoss-User] Nested findBys on the same Home
interfacedon'tw ork WAS RE: Finders


Hi,

I'm not familiar with CMP and Oracle 8.1.5,
but since this is read-only, and you are
using Minerva, it should be possible to find
out what is wrong here.

Since read-only, you know what is in the DB
at all times.

I would check the expression ccTx.getReferenceTx()
that you use to create a primary key for the
second finder. Does it return the expected value?

If that turns out OK, try adding some
System.err.println(...) to the ejbLoad(...) method
of your entity bean. Create this method if it does
not already exist. Print the primary key from the
bean context, and all the CMP fields.
Whenever your bean instance is synchronized from the
DB, the container will call ejbLoad() right after.
Do the right bean instances get loaded from the DB?
Does the context primary key match the primary key
field in your bean? (If not, you found a bad bug.)
Do other field have the values you would expect?

Hope this helps.


Best Regards,

Ole Husgaard.


Luis Ochoa wrote:
> 
> Thanks for your reply.
> 
> -Jboss is 2.0 FINAL
> -The code below executes in a session bean (part of a 1 session bean and 2
> entity beans app, all with "Required" transactional attributes)
> -I'm using CMP
> -Database is Oracle8.1.5 using Minerva pools with the 1.1.1 Oracle JDBC
> drivers (thus not using JDBC extensions).
> 
> -----Original Message-----
> From: Ole Husgaard [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 31, 2001 5:19 PM
> To: jBoss
> Subject: Re: [jBoss-User] Nested findBys on the same Home interface
> don'twork WAS RE: Finders
> 
> Hi,
> 
> If the code snippet below executes on the
> client, in another VM, I don't think it is
> a transactional issue, as the two finder
> methods execute in different transactions.
> 
> But otherwise it might be.
> 
> Which JBoss version?
> CMP ot BMP?
> Which database, and how is it set up in
> JBoss?
> 
> Best Regards,
> 
> Ole Husgaard.
> 
> Luis Ochoa wrote:
> >
> > Sorry to bother so often, but could this be a transactional issue?
> > Any takers?
> >
> > Thanks
> >
> > -----Original Message-----
> > From: Luis Ochoa [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 31, 2001 9:48 AM
> > To: 'jBoss'
> > Subject: [jBoss-User] Nested findBys on the same Home interface don't
> > work WAS RE: Fin ders
> >
> > 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
> >         }
> > }



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

Reply via email to