You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andreas Hartmann <an...@apache.org> on 2004/11/26 17:05:03 UTC

[Solved ]Re: [Forms, JDO, PostgreSQL] Saving to bean requires transaction

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