mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged DEV/DEREK_2.1 to HEAD
- Removed Node.parentAssocs mapping - Added parentAssocs transactional cache to NodeDAO - Added concurrency detection to TransactionalCache - Fixed cluster sample config git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5948 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -71,13 +71,13 @@ public class ChildAssocImpl implements ChildAssoc, Serializable
|
||||
// add the forward associations
|
||||
this.setParent(parentNode);
|
||||
this.setChild(childNode);
|
||||
childNode.getParentAssocs().add(this);
|
||||
// childNode.getParentAssocs().add(this);
|
||||
}
|
||||
|
||||
public void removeAssociation()
|
||||
{
|
||||
// maintain inverse assoc from child node to this instance
|
||||
this.getChild().getParentAssocs().remove(this);
|
||||
// // maintain inverse assoc from child node to this instance
|
||||
// this.getChild().getParentAssocs().remove(this);
|
||||
}
|
||||
|
||||
public ChildAssociationRef getChildAssocRef()
|
||||
|
@@ -45,6 +45,7 @@ import org.alfresco.repo.domain.Server;
|
||||
import org.alfresco.repo.domain.Store;
|
||||
import org.alfresco.repo.domain.StoreKey;
|
||||
import org.alfresco.repo.domain.Transaction;
|
||||
import org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.TransactionListenerAdapter;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
@@ -55,9 +56,11 @@ import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.BaseSpringTest;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.exception.ConstraintViolationException;
|
||||
import org.hibernate.exception.GenericJDBCException;
|
||||
import org.springframework.orm.hibernate3.HibernateCallback;
|
||||
|
||||
/**
|
||||
* Test persistence and retrieval of Hibernate-specific implementations of the
|
||||
@@ -292,7 +295,7 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
assertNotNull("Node not found", containerNode);
|
||||
|
||||
// check that we can traverse the association from the child
|
||||
Collection<ChildAssoc> parentAssocs = contentNode.getParentAssocs();
|
||||
Collection<ChildAssoc> parentAssocs = getParentAssocs(contentNode);
|
||||
assertEquals("Expected exactly 2 parent assocs", 2, parentAssocs.size());
|
||||
parentAssocs = new HashSet<ChildAssoc>(parentAssocs);
|
||||
for (ChildAssoc assoc : parentAssocs)
|
||||
@@ -304,10 +307,25 @@ public class HibernateNodeTest extends BaseSpringTest
|
||||
}
|
||||
|
||||
// check that the child now has zero parents
|
||||
parentAssocs = contentNode.getParentAssocs();
|
||||
parentAssocs = getParentAssocs(contentNode);
|
||||
assertEquals("Expected exactly 0 parent assocs", 0, parentAssocs.size());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<ChildAssoc> getParentAssocs(final Node childNode)
|
||||
{
|
||||
Query query = getSession()
|
||||
.createQuery(
|
||||
"select assoc from org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc " +
|
||||
"where " +
|
||||
" assoc.child.id = :childId " +
|
||||
"order by " +
|
||||
"assoc.index, assoc.id")
|
||||
.setLong("childId", childNode.getId());
|
||||
List<ChildAssoc> parentAssocs = query.list();
|
||||
return parentAssocs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows tracing of L2 cache
|
||||
*/
|
||||
|
@@ -91,6 +91,7 @@
|
||||
<element column="qname" type="QName" length="200"/>
|
||||
</set>
|
||||
<!-- inverse assoc to parent childassocs -->
|
||||
<!--
|
||||
<set
|
||||
name="parentAssocs"
|
||||
inverse="true"
|
||||
@@ -101,6 +102,7 @@
|
||||
<key column="child_node_id" />
|
||||
<one-to-many class="org.alfresco.repo.domain.hibernate.ChildAssocImpl" />
|
||||
</set>
|
||||
-->
|
||||
</class>
|
||||
|
||||
<class
|
||||
@@ -236,6 +238,18 @@
|
||||
assoc.id = :childAssocId
|
||||
</query>
|
||||
|
||||
<query name="node.GetParentAssocs">
|
||||
select
|
||||
assoc
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc
|
||||
where
|
||||
assoc.child.id = :childId
|
||||
order by
|
||||
assoc.index,
|
||||
assoc.id
|
||||
</query>
|
||||
|
||||
<query name="node.GetPrimaryChildNodeStatuses">
|
||||
select
|
||||
status
|
||||
@@ -283,9 +297,9 @@
|
||||
assoc.id
|
||||
</query>
|
||||
|
||||
<query name="node.GetChildAssocByShortName">
|
||||
<query name="node.GetChildAssocIdByShortName">
|
||||
select
|
||||
assoc
|
||||
assoc.id
|
||||
from
|
||||
org.alfresco.repo.domain.hibernate.ChildAssocImpl as assoc
|
||||
where
|
||||
|
Reference in New Issue
Block a user