cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <andr...@apache.org>
Subject [Solved ]Re: [Forms, JDO, PostgreSQL] Saving to bean requires transaction
Date Fri, 26 Nov 2004 16:05:03 GMT
Andreas Hartmann wrote:
> Hi Cocooners,
> 
> I'm using the Forms with JDO and a PostgreSQL database.
> Basically I'm doing the same stuff like in the JDO example
> (at least I think so ...)
> 
> Problem:
> 
> When the binding tries to set a field of the bean, the JDO-
> enhanced bean object complains that no transaction is active
> (JDOUserException, Eclipse debugger stack attached below)

The problem was that I fetched the objects using a query:

         manager.currentTransaction().begin();
         query = manager.newQuery(Semester.class);
         Collection semesters = (Collection) query.execute();
         manager.currentTransaction().commit();

This way, each object gets a JDO state manager attached.
That's why transactions are taken care of.

The beans have to be creating using the constructor, then
they won't require transactions in their setters.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message