Hi,

I discovered a behaviour while implementing a simple page to edit an entity 
bean which I can not explain what happens is right or not.

I expect:
My stateful session bean has the following annotations:

@Stateful
  | @Scope(ScopeType.EVENT)

and the following method to load the customer I like to edit in the page:

@Create
  |     public void loadCustomer() {

and the method to persist the changes:

public String persistChanges() {

So I expect, that I get an instance of the stateful session bean on which I 
call all three methods. But in reality, the method loadCustomer will be called 
more than once because I get another instance of the session bean (hash code) 
for loading the page and for saving the page. In addition, the instance also 
differs for saving the entity bean; reading the hash code of the bean instance 
in persistChanges(), the create annotated method gives me another hash code 
than the final instance in persistChanges. As far as I know, this behaviour is 
OK for J2EE because you do not care what instance you receive (instance 
pooling).

But I expected, that the seam context annotation for event or conversation 
should give me the same instance of the bean? It would be helpful for me if 
someone explain me about the relationship of the seam context's and their 
relation to the stateful session bean instances.

The business case works - the changed values will be persisted, but for me the 
create annotated method should only be called once ...

Regards,

Cyrill

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117373#4117373

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117373
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to