Ok, but when to use 'Supports'? Here is a simple entity Customer:
----8<----
public interface Customer extends EJBObject {
CustomerModel getDetails() throws RemoteException;
boolean isAuthorized() throws RemoteException;
}
---->8----
CustomerModel is a value object that represents the row in the database
which looks like this:
----8<-----
public class CustomerModel implements ValueObject
{
public Long id;
public String name;
public int status;
//... constructor
}
---->8----
ValueObject is just a marker interface that extends Serializable.
isAuthorized() returns true if status == AUTHORIZED. So my question is,
where do I need a transaction? Neither of these methods modify any data,
they are simply accessors. My thinking was to mark these as 'Supports', so
that if there was a tx them it would not interfere, causing a new tx or
commiting the first... granted I don't completely understand how the
container would treat either case.
Is there a general rule-of-thumb for determining what TIO to use for a
method? I read over the WL documentation, and they will use 'Supports' if
no TIO was specified, so I assumed that was the safe thing to do (and made
it explicit).
If the method modified data, then 'Required' seems like a good choice, but
what to use when no data is modified.
--jason
On Mon, 4 Dec 2000, Ingo Adler wrote:
> Marking methods as "Supports"-Transaction is not recommended.
> Their behavior can change depending on the transaction settings of the
> calling methods, which will imply an active transaction - or not. Inside
> your method you will never know for sure.
>
> Why don't you mark all methods (that manange states or entity beans) as
> "Required"?
> Typically, a call to a session bean is the smallest granularity of a
> transaction - not a call to an entity bean.
>
> Ingo
>
> -----Urspr�ngliche Nachricht-----
> Von: Jason Dillon [mailto:[EMAIL PROTECTED]]
>
> ...
>
> Do you know how to mark an entities create methods as 'Required',
> leaving
> the rest as 'Supports'?
>
> ...
>
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]