[JBoss jBPM] - Transactions on session facade in front of jBPM api
by mauroarc
Hi i have a session facade "addUser" to add users and memberships to JBPM db using IdentitySession api.
I want rollback transaction if some runtimexception occurs, but it doesn't work and data is persisted anyway.
I'm using datasource on jboss3.2.3 and i've configured hibernate to use that data source for its connections.
Maybe i'm missing somewhat, please help me.
Below the code:
public void addUser(HashMap params) {
log.debug("Start addUser");
IdentitySession identitySession = Util.getIdentitySession();
User user = new User( (String)params.get("userName"));
user.setEmail( (String)params.get("email"));
user.setPassword((String)params.get("userPwd"));
String[] userGroupIds= (String[])params.get("userGroups");
if ( userGroupIds!=null) {
long groupId=0;
for (int i=0; i<userGroupIds.length;i++) {
groupId = Long.parseLong( userGroupIds);
addMembership(user,groupId,identitySession);
}
}
identitySession.saveUser(user);
identitySession.getSession().flush();
log.debug("End addUser");
}
private void addMembership( User user, long groupId, IdentitySession identitySession) {
Group group = identitySession.loadGroup(groupId);
Membership membership = Membership.create(user,user.getName()+"_"+group.getId(), group);
user.addMembership(membership);
/*to simulate exception for testing*/
if (true) {
throw new RuntimeException("Error membership add");
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036706#4036706
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036706
19 years
[JBoss Seam] - Re: DataModelSelection not updated
by hispeedsurfer
Hi Pete,
I don't know what you mean. Neither page parameters nor el enhancement should be used for my problem.
First time I load a table with all entries. When I select a row, the correspondending entity is displayed on the bottom of the page.
Then I use search to reduce the table with this one
| <a:region id="searchRegion" renderRegionOnly="false">
| <h:inputText id="searchString" value="#{specialreleaselist.searchString}" style="width: 165px;">
| <a:support event="onkeyup" actionListener="#{specialreleaselist.find}" reRender="searchResults, lowerform" requestDelay="1" />
| </h:inputText>
| </a:region><!-- End searchRegion -->
|
A few entries are display now, but when I select on of these (i.e. the first one) the displayed entity is this one from whole table of the first load.
Why DataModelSelection not updated on search result table? There should be a possibility to refresh the DataModelSelection!
Have no idea to solve this with el or page parameters
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036700#4036700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036700
19 years