Hi!
Shahar Solomianik wrote:
> Perhaps you should invoke the overloaded methods using
> getEJBContext().getEJBObject().getNextKey.... and not directly.
> As I understand, that way the container is aware of the method invokation
> (cause its done through the remote interface, actually) and the transaction
> is handled correctly.
Yes, that's it.
/Rickard
>
> Shahar.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Lennart Petersson
> Sent: Wednesday, January 03, 2001 1:00 PM
> To: jBoss user
> Subject: [jBoss-User] TX question
>
> Having a CMP bean UniqueKey.
>
> Among all methods there are following:
>
> public String getNextKey()
> //This methods returns getNextKey(xxx)
>
> public String getNextKey(String upperLimit)
> //This methods return getNextKey(xxx,yyy)
>
> public String getNextKey(String upperLimit, String incrementValue)
> //This method calculates a new unique key
> //Calls setLastKey(newKey)
> //Returns newKey
>
> public void setLastKey(String newKey)
> //Updates the persisted field with newKey
>
> The client is in this case calling on the getNextKey() method with no
> argument, so the whole chain is used.
>
> I've used ejbdoclet 0.71 to generate all but the bean class and using
> Oracle 8.1.5 as database
>
> The bean has TX_SUPPORTS and my first try was to only have
> TX_REQUIRES_NEW on setLastKey().
>
> Result: Nothing updated in DB but the bean gives me a new key every
> time.
>
> Next try was to have TX_REQUIRES_NEW on getNextKey().
> Result: DB updated and beans gives me a new key every time.
>
> Note that it had no affect if a switched to TX_REQUIERES_NEW on one of
> the other getNextKey(...) methods, it was the one that was primarly
> called that was important.
>
> Is this really correct or a bug? In my logic it should be ok to have
> TX_REQUIRES_NEW only on the last method in the chain, setLastKey()?
>
> /Lennart
>
> --
> mailto:[EMAIL PROTECTED]
> http://www.benefit.se/english
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> List Help?: [EMAIL PROTECTED]
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> List Help?: [EMAIL PROTECTED]
--
Rickard �berg
Email: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]