persistence@glassfish.java.net

Re: Transaction isolation level

From: Craig L Russell <Craig.Russell_at_Sun.COM>
Date: Mon, 24 Sep 2007 09:12:17 -0700

Hi Chris,

On Sep 24, 2007, at 6:26 AM, Krzysztof Adamczyk wrote:

> Hi,
>
> Is it possible to set the transaction isolation level for a single
> method?
> What I'm going to do is to generate the invoice number that must be
> unique.
> I don't use sequences, because the number is generated for month
> and company department,
> so I would have a dynamic number of sequences.
> My idea is to have a method (generating invoice numbers) with the
> highest isolation level.
> Is this approach ok?

If you use session beans, you can define a method as "requires-new"
transaction and in that method access the database to get the new
invoice number.

For this purpose, a simple JDBC connection would probably be
preferable to using an entity...

Craig
>
> Thanks in advance.
> Chris
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell_at_sun.com
P.S. A good JDO? O, Gasp!