[JBoss Seam] - Outjected variables flawed.
by tony.herstell@gmail.com
I keep having to put all the getters and setters into my beans and not use @Out as I need the bean to have its @Create run (which populates the variables I am Outjecting)...
Basically: Outjecting variables means that you don't have the @Create run. for the bean that holds them
Anyone any idea how to get round this?
e.g.
| ...
| @SuppressWarnings("serial")
| @Stateful
| @Name("resourceAllocationController")
| @Scope(ScopeType.SESSION)
| public class ResourceAllocationControllerImpl implements ResourceAllocationController, Serializable {
| ...
|
| @Out
| private List<Day> varX;
|
| ...
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| @Create
| public void init() {
| //set varX up
| }
|
doesn't work... as in the view varX is accessed but init() is never run.
You have to add in getters and setters (lots of typing) and use a construct in the view like:
| <rich:dataTable var="eachDayForIndoorArena"
| value="#{resourceAllocationController.varX}"
| rendered="#{not empty resourceAllocationController.varX}">
|
instead of Outjecting and
| <rich:dataTable var="eachDayForIndoorArena"
| value="#{varX}"
| rendered="#{not empty varX}">
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127668#4127668
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127668
18 years, 2 months
[JBoss Seam] - serializing access to resource
by gsegura
Hello,
I need to access an entity bean instance in a serial fashion, so I kindly request for any pattern to implement this.
The use case is similar to managing an account balance, the account must be blocked during modification. I need to block other requests until the resource is available (as if it was a printer). That is why optimistic locking is not suitable.
I don't think synchronizing the SFSB which handles the entity bean is the best way since that would serialize invocation regardless of the entity bean instance been updated, I only want to avoid concurrently modifying the same entity bean instance.
Jboss 4.0 official guide describes the transaction lock behaviour which: anonymous wrote : ensures that only one transaction at a time has access to a given entity bean
But it is not clear to me how this apply in the case, for example, of two entitymanagers loading same entity bean. Does it mean the second one's thread will be locked at that precise moment?
Also I don't quite grasp the behavior of entitymanager.lock(), what happens when another thread tries to lock one entity bean instance already locked? the locking effect is global to different entitymanager instances?
I deeply appreciate any advice
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127665#4127665
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127665
18 years, 2 months