Fixes problems AVM tables were having with utf8 encodiing and mysql.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3618 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-08-28 00:43:39 +00:00
parent 8031cc6574
commit 8c92c87ac3
8 changed files with 240 additions and 30 deletions

View File

@@ -29,6 +29,11 @@ class AVMAspectNameImpl implements AVMAspectName, Serializable
{ {
private static final long serialVersionUID = -6282415309583571934L; private static final long serialVersionUID = -6282415309583571934L;
/**
* The Primary Key.
*/
private Long fID;
/** /**
* The Node that has the named aspect. * The Node that has the named aspect.
*/ */
@@ -82,6 +87,24 @@ class AVMAspectNameImpl implements AVMAspectName, Serializable
return fName; return fName;
} }
/**
* Set the primary key (For Hibernate)
* @param id The primary key.
*/
protected void setId(Long id)
{
fID = id;
}
/**
* Get the primary key (For Hibernate)
* @return The primary key.
*/
protected Long getId()
{
return fID;
}
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {

View File

@@ -30,6 +30,11 @@ class AVMNodePropertyImpl implements AVMNodeProperty, Serializable
{ {
private static final long serialVersionUID = -7194228119659288619L; private static final long serialVersionUID = -7194228119659288619L;
/**
* The primary key.
*/
private Long fID;
/** /**
* The node that owns this. * The node that owns this.
*/ */
@@ -105,4 +110,43 @@ class AVMNodePropertyImpl implements AVMNodeProperty, Serializable
{ {
fValue = value; fValue = value;
} }
/**
* Set the primary key. (For Hibernate)
* @param id The primary key.
*/
protected void setId(Long id)
{
fID = id;
}
/**
* Get the primary key. (For Hibernate)
* @return The primary key.
*/
protected Long getId()
{
return fID;
}
@Override
public boolean equals(Object other)
{
if (this == other)
{
return true;
}
if (!(other instanceof AVMNodeProperty))
{
return false;
}
AVMNodeProperty o = (AVMNodeProperty)other;
return fNode.equals(o.getNode()) && fName.equals(o.getName());
}
@Override
public int hashCode()
{
return fNode.hashCode() + fName.hashCode();
}
} }

View File

@@ -30,6 +30,11 @@ class AVMStorePropertyImpl implements AVMStoreProperty, Serializable
{ {
private static final long serialVersionUID = -5419606158990318723L; private static final long serialVersionUID = -5419606158990318723L;
/**
* The Primary Key.
*/
private Long fID;
/** /**
* The store that owns this property. * The store that owns this property.
*/ */
@@ -102,5 +107,44 @@ class AVMStorePropertyImpl implements AVMStoreProperty, Serializable
{ {
fValue = value; fValue = value;
} }
/**
* Set the primary key. (For Hibernate)
* @param id The primary key.
*/
protected void setId(Long id)
{
fID = id;
}
/**
* Get the primary key. (For Hibernate)
* @return The primary key.
*/
protected Long getId()
{
return fID;
}
@Override
public boolean equals(Object other)
{
if (this == other)
{
return true;
}
if (!(other instanceof AVMStoreProperty))
{
return false;
}
AVMStoreProperty o = (AVMStoreProperty)other;
return fStore.equals(o.getStore()) && fName.equals(o.getName());
}
@Override
public int hashCode()
{
return fStore.hashCode() + fName.hashCode();
}
} }

View File

@@ -55,8 +55,12 @@ class ChildEntryDAOHibernate extends HibernateDaoSupport implements
*/ */
public ChildEntry getByNameParent(String name, DirectoryNode parent) public ChildEntry getByNameParent(String name, DirectoryNode parent)
{ {
ChildEntry query = new ChildEntryImpl(name, parent, null); Query query = getSession().createQuery(
return (ChildEntry)getSession().get(ChildEntryImpl.class, (Serializable)query); "from ChildEntryImpl ce where ce.name = :name and ce.parent = :parent");
query.setString("name", name);
query.setEntity("parent", parent);
query.setCacheable(true);
return (ChildEntry)query.uniqueResult();
} }
/** /**

View File

@@ -27,6 +27,11 @@ class ChildEntryImpl implements ChildEntry, Serializable
{ {
private static final long serialVersionUID = -307752114272916930L; private static final long serialVersionUID = -307752114272916930L;
/**
* The primary key.
*/
private Long fID;
/** /**
* The name of the entry. * The name of the entry.
*/ */
@@ -170,4 +175,22 @@ class ChildEntryImpl implements ChildEntry, Serializable
{ {
fVers = vers; fVers = vers;
} }
/**
* Set the primary key. (For Hibernate)
* @param id
*/
protected void setId(Long id)
{
fID = id;
}
/**
* Get the primary key. (For Hibernate).
* @return The primary key.
*/
protected Long getId()
{
return fID;
}
} }

View File

@@ -27,6 +27,11 @@ class DeletedChildImpl implements DeletedChild, Serializable
{ {
private static final long serialVersionUID = 4997060636280774719L; private static final long serialVersionUID = 4997060636280774719L;
/**
* The Primary Key.
*/
private Long fID;
/** /**
* The name of the deleted child. * The name of the deleted child.
*/ */
@@ -121,4 +126,22 @@ class DeletedChildImpl implements DeletedChild, Serializable
{ {
return fParent.hashCode() + fName.hashCode(); return fParent.hashCode() + fName.hashCode();
} }
/**
* Set the primary key. (For Hibernate)
* @param id The primary key.
*/
protected void setId(Long id)
{
fID = id;
}
/**
* Get the primary key. (For Hibernate)
* @return The primary key.
*/
protected Long getId()
{
return fID;
}
} }

View File

@@ -27,6 +27,11 @@ class NewInAVMStoreImpl implements NewInAVMStore, Serializable
{ {
private static final long serialVersionUID = 1905996612150732182L; private static final long serialVersionUID = 1905996612150732182L;
/**
* The Primary Key.
*/
private Long fID;
/** /**
* The AVMStore. * The AVMStore.
*/ */
@@ -86,5 +91,45 @@ class NewInAVMStoreImpl implements NewInAVMStore, Serializable
{ {
fAVMStore = store; fAVMStore = store;
} }
/**
* Set the primary key. (For Hibernate)
* @param id The primary key.
*/
protected void setId(Long id)
{
fID = id;
}
/**
* Get the primary key. (For Hibernate)
* @return The primary key.
*/
protected Long getId()
{
return fID;
}
@Override
public boolean equals(Object other)
{
if (this == other)
{
return true;
}
if (!(other instanceof NewInAVMStore))
{
return false;
}
NewInAVMStore o = (NewInAVMStore)other;
return fAVMStore.equals(o.getAvmStore()) &&
fNode.equals(o.getNode());
}
@Override
public int hashCode()
{
return fAVMStore.hashCode() + fNode.hashCode();
}
} }

View File

@@ -128,24 +128,23 @@
</class> </class>
<class name="ChildEntryImpl" proxy="ChildEntry" table="avm_child_entries" optimistic-lock="version"> <class name="ChildEntryImpl" proxy="ChildEntry" table="avm_child_entries" optimistic-lock="version">
<cache usage="read-write"/> <cache usage="read-write"/>
<composite-id> <id name="id" column="id" type="long">
<key-property name="name" type="string" column="name"> <generator class="native"/>
</key-property> </id>
<key-many-to-one name="parent" column="parent_id" class="DirectoryNodeImpl">
</key-many-to-one>
</composite-id>
<version name="vers" column="vers" type="long"/> <version name="vers" column="vers" type="long"/>
<property name="name" type="string" column="name" index="child_name_index" not-null="true"/>
<many-to-one name="parent" column="parent_id" class="DirectoryNodeImpl" not-null="true"/>
<many-to-one name="child" column="child_id" class="AVMNodeImpl" <many-to-one name="child" column="child_id" class="AVMNodeImpl"
not-null="true"> not-null="true"/>
</many-to-one>
</class> </class>
<class table="avm_deleted_children" name="DeletedChildImpl" proxy="DeletedChild"> <class table="avm_deleted_children" name="DeletedChildImpl" proxy="DeletedChild">
<cache usage="read-write"/> <cache usage="read-write"/>
<composite-id> <id name="id" column="id" type="long">
<key-property name="name" column="name" type="string"/> <generator class="native"/>
<key-many-to-one name="parent" class="LayeredDirectoryNodeImpl" </id>
<property name="name" column="name" type="string" index="deleted_child_name_index"/>
<many-to-one name="parent" class="LayeredDirectoryNodeImpl"
column="parent_id"/> column="parent_id"/>
</composite-id>
</class> </class>
<class name="HistoryLinkImpl" proxy="HistoryLink" table="avm_history_links"> <class name="HistoryLinkImpl" proxy="HistoryLink" table="avm_history_links">
<composite-id> <composite-id>
@@ -160,16 +159,19 @@
</composite-id> </composite-id>
</class> </class>
<class name="NewInAVMStoreImpl" proxy="NewInAVMStore" table="new_in_avm_store_nodes"> <class name="NewInAVMStoreImpl" proxy="NewInAVMStore" table="new_in_avm_store_nodes">
<composite-id> <cache usage="read-write"/>
<key-many-to-one name="avmStore" class="AVMStoreImpl" column="avm_store_id"/> <id name="id" column="id" type="long">
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/> <generator class="native"/>
</composite-id> </id>
<many-to-one name="avmStore" class="AVMStoreImpl" column="avm_store_id"/>
<many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
</class> </class>
<class name="AVMNodePropertyImpl" proxy="AVMNodeProperty" table="avm_node_properties"> <class name="AVMNodePropertyImpl" proxy="AVMNodeProperty" table="avm_node_properties">
<composite-id> <id name="id" column="id" type="long">
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/> <generator class="native"/>
<key-property name="name" column="qname" type="QName" length="200"/> </id>
</composite-id> <many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
<property name="name" column="qname" type="QName" length="200" index="node_property_name_index"/>
<component class="org.alfresco.repo.domain.PropertyValue" name="value"> <component class="org.alfresco.repo.domain.PropertyValue" name="value">
<property name="actualType" column="actual_type" type="string" length="15" not-null="true" /> <property name="actualType" column="actual_type" type="string" length="15" not-null="true" />
<property name="multiValued" column="multi_valued" type="boolean" not-null="true" /> <property name="multiValued" column="multi_valued" type="boolean" not-null="true" />
@@ -183,10 +185,11 @@
</component> </component>
</class> </class>
<class name="AVMStorePropertyImpl" proxy="AVMStoreProperty" table="avm_store_properties"> <class name="AVMStorePropertyImpl" proxy="AVMStoreProperty" table="avm_store_properties">
<composite-id> <id name="id" column="id" type="long">
<key-many-to-one name="store" class="AVMStoreImpl" column="avm_store_id"/> <generator class="native"/>
<key-property name="name" column="qname" type="QName" length="200"/> </id>
</composite-id> <many-to-one name="store" class="AVMStoreImpl" column="avm_store_id"/>
<property name="name" column="qname" type="QName" length="200" index="store_property_name_index"/>
<component class="org.alfresco.repo.domain.PropertyValue" name="value"> <component class="org.alfresco.repo.domain.PropertyValue" name="value">
<property name="actualType" column="actual_type" type="string" length="15" not-null="true" /> <property name="actualType" column="actual_type" type="string" length="15" not-null="true" />
<property name="multiValued" column="multi_valued" type="boolean" not-null="true" /> <property name="multiValued" column="multi_valued" type="boolean" not-null="true" />
@@ -201,10 +204,11 @@
</class> </class>
<!-- Aspect name table for AVM Nodes. --> <!-- Aspect name table for AVM Nodes. -->
<class name="AVMAspectNameImpl" proxy="AVMAspectName" table="avm_aspects"> <class name="AVMAspectNameImpl" proxy="AVMAspectName" table="avm_aspects">
<composite-id> <id name="id" column="id" type="long">
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/> <generator class="native"/>
<key-property name="name" column="qname" type="QName" length="200"/> </id>
</composite-id> <many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
<property name="name" column="qname" type="QName" length="200"/>
</class> </class>
<query name="ChildEntry.ByNameParent"> <query name="ChildEntry.ByNameParent">
<![CDATA[ <![CDATA[