I think I understand now. The only fuzzy part is how to tell the EJB
about the 2.x local interface in addition to the business local
interface since @Local is already being used. My guess in the EJB
should implement the EJB 2.x local interface, then use the @Local
annotation to specify the 3.x business interface:
public interface TransHistory2xLocalHome extends EJBLocalHome {
public TransHistory2xLocal create() throws CreateException;
}
public interface TransHistory2xLocal extends EJBLocalObject {
public void recordSuccessfulTransaction(Reservation res);
public void recordFailedTransaction(String errorCode, String
errorMessage, Reservation res);
}
@Local
public interface TransHistoryLocal {
public void recordSuccessfulTransaction(Reservation res);
public void recordFailedTransaction(String errorCode, String
errorMessage, Reservation res);
}
@Stateless
@LocalHome(TransHistoryLocalHome.class)
public class TransHistoryBean implements TransHistory2xLocal {
public void recordSuccessfulTransaction(Reservation res) {
//...
}
public void recordFailedTransaction(String errorCode, String
errorMessage, Reservation res) {
//...
}
}
No need to add a create method or even @Init in the EJB.
Thanks,
Ryan
glassfish_at_javadesktop.org wrote:
>> public interface TransHistoryLocalHome extends
>> EJBHome {
>>
>
> EJBLocalHome instead
>
>
>> public TransHistoryLocal create() throws
>> CreateException;
>>
>
> Right, must have 0 params since it's for a stateless session bean.
> You don't have to implement a corresponding "ejbCreate" method
> on the bean class.
>
>
>>
>> 2) Do I need to create a different Local interface
>> for use by EJB 2.x
>> clients than my existing Local interface?
>>
>
> Yes, the 2.x Local interface is distinct from the 3.0 Local business interface.
> They can define the same methods.
>
> One thing to note is if you previously defined the local business interface
> by putting it in the bean class implements clause without annotating it with
> @Local, you'll need to explicitly add the @Local annotation. That default
> only applies when the bean doesn't expose any other view. Once @LocalHome
> is there, you'll need to specifically state that the Local business interface is
> indeed a local business interface.
>