> Ok, but when to use 'Supports'? As I understand it - never. "The Supports transaction attribute must be used with caution. This is because of the different transactional semantics provided by the two possible modes of execution. Only the enterprise beans that will execute correctly in both modes should use the Supports transaction attribute." [ejb1_1-spec, 11.6.2.3] I had a paper that stated it more clearly - I can't find it anymore. Your getDetails-Method is accessing the database which will create a transaction for it, regardless if you just read the data or not. But because you are using CMT you should let the container always manage the transactions (or never - BMT). Ingo -----Urspr�ngliche Nachricht----- Von: Jason Dillon [mailto:[EMAIL PROTECTED]] Gesendet: Montag, 4. Dezember 2000 22:53 An: jBoss Betreff: Re: AW: [jBoss-User] Re: Entities, Transactions & Commits (Ohmy...HELP!) ----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]
