[JBoss Seam] - Re: ManyToMany association within conversation scope bean
by avpavlov
"pete.muir(a)jboss.org" wrote : ... hibernate is though in the persistence context?
I'm not sure I understand that :) Could you please clarify? Do you mean hibernate fetched collection to Provider bean and did not refresh when User form saved (== links changed)? If yes, why usernames were refreshed - these referenced from collection and refreshed properly.
I agree that probaly I'm wrong when blame Seam but there are a lot of annotations and I assumed that some combination (or simply missed) annotations lead to this side effect.
At the moment I "brute-forced" it :) - set event listener to post-ins/upd/del event, register provider form method as event observer and check for collections inconsistencies
| if (r instanceof User) {
| User u = (User)r;
| if (getProvider().getUsers().contains(u) != u.getProviders().contains(getProvider())) {
| entityManager.refresh(getProvider());
| }
| }
|
It works but I'm sure there is better solution (at least not so "in-place").
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111531#4111531
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111531
18 years, 4 months
[JBossCache] - Optimistic Locking
by spennec
Hello,
I read the documentation and didn't understand a part of it:
anonymous wrote :
| For example, if a transaction calls cache.getRoot().getChild( Fqn.fromString("/a/b/c") ) , nodes a, b and c are copied from the main data tree and into the workspace. The data is versioned and all calls in the transaction work on the copy of the data rather than the actual data. When the transaction commits, its workspace is merged back into the underlying tree by matching versions. If there is a version mismatch - such as when the actual data tree has a higher version than the workspace, perhaps if another transaction were to access the same data, change it and commit before the first transaction can finish - the transaction throws a RollbackException when committing and the commit fails.
|
Is TreeCache going to follow this behaviour even during read calls? In the case of a thread that reads a value, while another one is modifying that same value, does the reader thread get an Exception?
The kind of bahaviour that I need is this:
- All reads can get the value immediately
- All writes must wait for another write to finish to get a lock
- A read call that happens while a writer thread locks the data recieves the data that was in the cache before the lock. In other words, the data is visible to other thread only once the writer thread has committed.
Would that be possible with Optimistic locking?
Thanks for your help :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111530#4111530
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111530
18 years, 4 months
[JBoss Seam] - Outject doesn't work
by Bernix
I have an UserListBean, a userList.xhtml page and a userView.xhtml page,and when I try to outject the DataModelSelection,from the list page to the view page,but it doesn't work:
UserListBean.java
@Stateful
| @Scope(SEESION)
| @Name("userList")
| public class UserListBean implememts UserList {
| @DataModel
| private List<User> users;
|
| @DataModelSelection
| @Out (required = false)
| private User user;
|
| @Factory
| public void getUsers () {
| ...
| }
| }
userList.xhtml
<rich:dataTable var="usr" value="#{users}">
| <h:column>
| <f:facet name="header">User Name</f:facet>
| #{usr.username}
| </h:column>
| ...
| <h:column>
| <f:facet name="header">View</f:facet>
| <s:link id="viewUser" value="View" action="/userView.xhtml"/>
| </h:column>
| </rich:dataTable>
userView.xhtml
<rich:panel>
| <s:decorate template="/layout/display.xhtml">
| <ui:define name="label">User Name:</ui:define>
| #{user.username}
| </s:decorate>
| ...
| </rich:panel>
everything seems ok,but when I click "View" from the list page to view page,the view page doesn't get the "user",I chek the log,it says that the component user is not found.....means it didn't outject correctly...
I know may be this kind of problem has been discussed in the forum before,but I just can not find it...
I suppose that when I select the user from the list page,the DataModelSelection does inject to "userList",but it didn't outject...
when will the outject will be processed?at the very begin when the component create?
in many scenario,the variable is null when the component is created,but I want to outject that variable when it gets a value....
any comments will be greatful
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111526#4111526
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111526
18 years, 4 months