Does not conversation work in rpc from gwt?
yoshiki Apr 22, 2010 12:22 PMHi all.
I want to have seam and conversation in rpc from gwt.
This is the code of the server-side.
@Stateful
@Scope(ScopeType.CONVERSATION)
@Name(gwt2SeamService
)
public class GWT2SeamServiceImpl implements GWT2SeamServiceLocal {
@Logger
private Log log;
@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager entityManager;
@In(create=true)
@Out(required=false)
private User user;
public GWT2SeamServiceImpl(){
}
@Begin
public String begin(String question) {
log(begin
);
return processToString();
}
public String process(String question) {
log(process
);
return processToString();
}
@End
public String end(String question) {
log(end
);
entityManager.persist(user);
return processToString();
}
@Destroy
@Remove
public void destroy() {
}
private void log(String desc){
log.info(CurrentConversationId:
+ Manager.instance().getCurrentConversationId());
}
private String processToString() {
return new StringBuilder()
.append(hash:
).append(hashCode())
.append(entityManager:
).append(entityManager.hashCode())
.append(user:
).append(user.hashCode())
.toString();
}
}
@Local
public interface GWT2SeamServiceLocal extends GWT2SeamService {
@WebRemote
public String begin(String question);
@WebRemote
public String process(String question);
@WebRemote
public String end(String question);
public void destroy();
}
The communication of a client and the server succeeded,
but CurrentConversationId
is done increment of even if I carry out process
after begin
.
Furthermore, CurrentConversationId
is done increment of even if I carry out only process
.
Is there the method to use the same component from begin
to end
?
Thanks.