Low,
Right you are, standard jdo works fine.
The culprit was the placement of the db.commit().
Here's the code segment that works:

try{
  db.begin();
  oql = db.getOQLQuery( "SELECT m FROM
com.workzen.app.velocityCastor.om.Message m" );
  results = oql.execute();
  // store the messages into a hashtable
  while ( results.hasMore() ) {
    Message m = (Message)results.next();
    messages.put(m.getId(), m);
    }
}catch(Exception e){
  db.rollback();
  throw new Exception(e.getMessage());
}finally{
  db.commit();
}

Thanks again,
Brad

----- Original Message -----
From: "Brad Matlack" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 23, 2001 12:55 PM
Subject: Re: [castor-dev] JSP support?


> Low,
>
> The reason for my original question, was that my JSP jdo code was throwing
a
> "TransactionNotInProgressException":
>
> Error handling the request: javax.servlet.ServletException:
> org.exolab.castor.jdo.TransactionNotInProgressException: Transaction not
in
> progress -- must open a transaction in order to perform this operation
>
> Here is the code segment:
>
> db = jdo.getDatabase();
> try{
>   db.begin();
>   oql = db.getOQLQuery( "SELECT m FROM Message m" );
>   results = oql.execute();
>   db.commit();
> }catch(Exception e){
>   db.rollback();
>   throw new Exception(e.getMessage());
> }
>
> Is there a problem with this approach???
> Thanks,
> Brad
>
> ----- Original Message -----
> From: "Low Heng Sin" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 22, 2001 7:00 PM
> Subject: Re: [castor-dev] JSP support?
>
>
> > No, lookup is for ejb only. Just use jdo.getDatabase(), db.begin() and
> > db.commit()/rollback() in pure jsp/servlet environment.
> >
> > Regards,
> > Low Heng Sin ( [EMAIL PROTECTED] )
> >
> > -----Original Message-----
> > From: Brad Matlack [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, August 23, 2001 6:43
> > To: [EMAIL PROTECTED]
> > Subject: [castor-dev] JSP support?
> >
> >
> > I'm trying to apply the example Java application to a JSP environment,
and
> I
> > am now running into this exception:
> > TransactionNotInProgressException: This transaction is not open...
> >
> > By this message, I am assuming that instead of
> > db = jdo.getDatabase();
> > I have to use
> > db = (Database) ctx.lookup( "java:comp/env/jdo/mydb" );
> >
> > Is this correct for JSP? (The documentation says YES for EJB)
> > If yes, then, what is, or where can I find, the correct syntax for the
> > lookup()?
> > And finally, are there any JSP examples out in the world???
> >
> > Thank you,
> > Brad
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to