From: thhal at tigris.org (Thomas Hallgren) Date: Sat, 15 Oct 2005 21:40:09 +0200 Subject: [Pljava-dev] Transaction & java session In-Reply-To: <43469BDF0001CE1D@mail-2.mail.tiscali.sys> References: <43469BDF0001CE1D@mail-2.mail.tiscali.sys> Message-ID: <43515B18.4060409@tigris.org> rcolmegna at tiscali.it wrote: > Hi, > > there is some method to simulate a java-session related to a transaction? > > In other word: the trigger call is excecuted against static class-method. > There > is any way to detect that the call come from a given session and route it > to the > same instance of a given object? > There is always an implicit session. The current Session can be obtained with Session current = SessionManager.current(); This session maps to the PostgreSQL session, i.e. the backend process that PL/Java currently executes in. The duration of this session is longer than the duration of a transaction. > And ... another question: the only wait from PLJAVA to force a > rollback is > to execute > a referential-broken INS/UPD? > The easiest way to cause a rollback is to simply throw an SQLException. Regards, Thomas Hallgren