[
https://issues.jboss.org/browse/SEAMSECURITY-69?page=com.atlassian.jira.p...
]
José Freitas commented on SEAMSECURITY-69:
------------------------------------------
Bill,
I think the problem is that you're not flushing the jpasession.
try adding @Transactional from seam-persistence (and in near future from
seam-transaction), it will flush for you.
{code}
@Transactional
public String testAction() throws IdentityException {
PersistenceManager pm = identitySession.getPersistenceManager();
RelationshipManager rm = identitySession.getRelationshipManager();
Group head = pm.findGroup("Head Office", groupType);
Group branch = pm.findGroup("Branch Office", groupType);
if( ! rm.isAssociated(head, branch) ) {
rm.associateGroups(head, branch);
}
if(rm.isAssociated(head, branch))
return "sucess";
return "false";
}
{code}
using this code, I couldn't replicate your issue.
Call to associateGroups(head, branch) does not persist the group
relationship
-----------------------------------------------------------------------------
Key: SEAMSECURITY-69
URL:
https://issues.jboss.org/browse/SEAMSECURITY-69
Project: Seam Security
Issue Type: Bug
Affects Versions: 3.0.0.Final
Environment: Windows 7 x64, MySQL 5.1
Reporter: Bill Elliot
This is using MySQL 5.1 and it appears the association is not being persisted. If I
manually enter the table row the association is detected correctly. But, the call to
associateGroups is not persisting the relationship. I have used the following code to test
out this:
package org.jboss.seam.security.examples.idmconsole.tests;
import javax.inject.Inject;
import org.picketlink.idm.api.Group;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.api.PersistenceManager;
import org.picketlink.idm.api.RelationshipManager;
import org.picketlink.idm.common.exception.IdentityException;
public class TestSecurity {
@Inject IdentitySession identitySession;
public String testAction() throws IdentityException {
PersistenceManager pm = identitySession.getPersistenceManager();
RelationshipManager rm = identitySession.getRelationshipManager();
Group head = pm.findGroup("Head Office",
"ORGANIZATION_UNIT");
Group branch = pm.findGroup("Branch Office",
"ORGANIZATION_UNIT");
if( ! rm.isAssociated(head, branch) ) {
rm.associateGroups(head, branch);
}
boolean isAssociated = rm.isAssociated(head, branch);
return null;
}
}
The 2 groups in the test code exist in my test DB when I run the above code. I single
step through the code to verify the situation after each line and everything is as
expected, except that the call to rm.associateGroups(head, branch); does not persist the
association.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira