Fixed AR-571:

- Moved to use Set-based associations for child and node associations


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2848 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-05-11 15:24:43 +00:00
parent 174282804f
commit 5140d956b4
3 changed files with 54 additions and 44 deletions

View File

@@ -151,11 +151,12 @@ public class ChildAssocImpl implements ChildAssoc
return false;
}
ChildAssoc that = (ChildAssoc) obj;
return (this.getIsPrimary() == that.getIsPrimary()
&& EqualsHelper.nullSafeEquals(this.getTypeQName(), that.getTypeQName())
return (
EqualsHelper.nullSafeEquals(this.getTypeQName(), that.getTypeQName())
&& EqualsHelper.nullSafeEquals(this.getQname(), that.getQname())
&& EqualsHelper.nullSafeEquals(this.getParent(), that.getParent())
&& EqualsHelper.nullSafeEquals(this.getChild(), that.getChild()));
&& EqualsHelper.nullSafeEquals(this.getChild(), that.getChild())
);
}
public int hashCode()

View File

@@ -75,54 +75,58 @@
name="aspects"
table="node_aspects"
lazy="false"
fetch="join"
inverse="false"
sort="unsorted"
fetch="join"
optimistic-lock="true"
cascade="delete" >
<key column="node_id" not-null="true" />
<element column="qname" type="QName" length="200"/>
</set>
<!-- inverse assoc to parent childassocs -->
<bag
<set
name="parentAssocs"
lazy="true"
inverse="true"
lazy="true"
fetch="select"
cascade="none"
optimistic-lock="true"
fetch="select" >
optimistic-lock="true" >
<key column="child_node_id" />
<one-to-many class="org.alfresco.repo.domain.hibernate.ChildAssocImpl" />
</bag>
</set>
<!-- inverse assoc to child childassocs -->
<bag
<set
name="childAssocs"
inverse="true"
lazy="true"
fetch="select"
cascade="none"
optimistic-lock="true"
fetch="select" >
optimistic-lock="true" >
<key column="parent_node_id" />
<one-to-many class="org.alfresco.repo.domain.hibernate.ChildAssocImpl" />
</bag>
</set>
<!-- inverse assoc to source nodeassocs -->
<bag
<set
name="sourceNodeAssocs"
inverse="true"
lazy="true"
fetch="select"
cascade="none"
optimistic-lock="true" >
<key column="target_node_id" />
<one-to-many class="org.alfresco.repo.domain.hibernate.NodeAssocImpl" />
</bag>
</set>
<!-- inverse assoc to target nodeassocs -->
<bag
<set
name="targetNodeAssocs"
inverse="true"
lazy="true"
fetch="select"
cascade="none"
optimistic-lock="true" >
<key column="source_node_id" />
<one-to-many class="org.alfresco.repo.domain.hibernate.NodeAssocImpl" />
</bag>
</set>
</class>
<class
@@ -145,10 +149,10 @@
name="node"
class="org.alfresco.repo.domain.hibernate.NodeImpl"
column="node_id"
unique="false"
not-null="false"
lazy="false"
fetch="join"
lazy="false" />
unique="false"
not-null="false" />
<property name="changeTxnId" column="change_txn_id" type="string" length="56" not-null="true" />
<property name="deleted" column="deleted" type="boolean" not-null="true" />
</class>
@@ -165,10 +169,6 @@
<id name="id" column="id" type="long" >
<generator class="native" />
</id>
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" />
<property name="qname" column="qname" type="QName" length="255" not-null="true" />
<property name="isPrimary" column="is_primary" />
<property name="index" column="assoc_index" />
<!-- forward assoc to parent node -->
<many-to-one
name="parent"
@@ -189,6 +189,10 @@
not-null="true" >
<column name="child_node_id" />
</many-to-one>
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" />
<property name="qname" column="qname" type="QName" length="255" not-null="true" />
<property name="isPrimary" column="is_primary" />
<property name="index" column="assoc_index" />
</class>
<class
@@ -199,21 +203,27 @@
<id name="id" column="id" type="long" >
<generator class="native" />
</id>
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" />
<!-- forward assoc to source node -->
<many-to-one
name="source"
class="org.alfresco.repo.domain.hibernate.NodeImpl"
not-null="true" >
<column name="source_node_id" />
</many-to-one>
<!-- forward assoc to target node -->
<many-to-one
name="target"
class="org.alfresco.repo.domain.hibernate.NodeImpl"
not-null="true" >
<column name="target_node_id" />
</many-to-one>
<natural-id mutable="true">
<!-- forward assoc to source node -->
<many-to-one
name="source"
class="org.alfresco.repo.domain.hibernate.NodeImpl"
lazy="false"
fetch="join"
not-null="true" >
<column name="source_node_id" />
</many-to-one>
<!-- forward assoc to target node -->
<many-to-one
name="target"
class="org.alfresco.repo.domain.hibernate.NodeImpl"
lazy="false"
fetch="join"
not-null="true" >
<column name="target_node_id" />
</many-to-one>
<property name="typeQName" column="type_qname" type="QName" length="255" not-null="true" />
</natural-id>
</class>
<query name="store.GetAllStores">

View File

@@ -16,7 +16,6 @@
*/
package org.alfresco.repo.domain.hibernate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -66,10 +65,10 @@ public class NodeImpl extends LifecycleAdapter implements Node
public NodeImpl()
{
aspects = new HashSet<QName>(5);
sourceNodeAssocs = new ArrayList<NodeAssoc>(3);
targetNodeAssocs = new ArrayList<NodeAssoc>(3);
parentAssocs = new ArrayList<ChildAssoc>(3);
childAssocs = new ArrayList<ChildAssoc>(3);
sourceNodeAssocs = new HashSet<NodeAssoc>(5);
targetNodeAssocs = new HashSet<NodeAssoc>(5);
parentAssocs = new HashSet<ChildAssoc>(5);
childAssocs = new HashSet<ChildAssoc>(11);
properties = new HashMap<QName, PropertyValue>(5);
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();