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;
/**
* The Primary Key.
*/
private Long fID;
/**
* The Node that has the named aspect.
*/
@@ -82,6 +87,24 @@ class AVMAspectNameImpl implements AVMAspectName, Serializable
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
public boolean equals(Object obj)
{

View File

@@ -30,6 +30,11 @@ class AVMNodePropertyImpl implements AVMNodeProperty, Serializable
{
private static final long serialVersionUID = -7194228119659288619L;
/**
* The primary key.
*/
private Long fID;
/**
* The node that owns this.
*/
@@ -105,4 +110,43 @@ class AVMNodePropertyImpl implements AVMNodeProperty, Serializable
{
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;
/**
* The Primary Key.
*/
private Long fID;
/**
* The store that owns this property.
*/
@@ -102,5 +107,44 @@ class AVMStorePropertyImpl implements AVMStoreProperty, Serializable
{
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)
{
ChildEntry query = new ChildEntryImpl(name, parent, null);
return (ChildEntry)getSession().get(ChildEntryImpl.class, (Serializable)query);
Query query = getSession().createQuery(
"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;
/**
* The primary key.
*/
private Long fID;
/**
* The name of the entry.
*/
@@ -170,4 +175,22 @@ class ChildEntryImpl implements ChildEntry, Serializable
{
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;
/**
* The Primary Key.
*/
private Long fID;
/**
* The name of the deleted child.
*/
@@ -121,4 +126,22 @@ class DeletedChildImpl implements DeletedChild, Serializable
{
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;
/**
* The Primary Key.
*/
private Long fID;
/**
* The AVMStore.
*/
@@ -86,5 +91,45 @@ class NewInAVMStoreImpl implements NewInAVMStore, Serializable
{
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 name="ChildEntryImpl" proxy="ChildEntry" table="avm_child_entries" optimistic-lock="version">
<cache usage="read-write"/>
<composite-id>
<key-property name="name" type="string" column="name">
</key-property>
<key-many-to-one name="parent" column="parent_id" class="DirectoryNodeImpl">
</key-many-to-one>
</composite-id>
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<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"
not-null="true">
</many-to-one>
not-null="true"/>
</class>
<class table="avm_deleted_children" name="DeletedChildImpl" proxy="DeletedChild">
<cache usage="read-write"/>
<composite-id>
<key-property name="name" column="name" type="string"/>
<key-many-to-one name="parent" class="LayeredDirectoryNodeImpl"
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<property name="name" column="name" type="string" index="deleted_child_name_index"/>
<many-to-one name="parent" class="LayeredDirectoryNodeImpl"
column="parent_id"/>
</composite-id>
</class>
<class name="HistoryLinkImpl" proxy="HistoryLink" table="avm_history_links">
<composite-id>
@@ -160,16 +159,19 @@
</composite-id>
</class>
<class name="NewInAVMStoreImpl" proxy="NewInAVMStore" table="new_in_avm_store_nodes">
<composite-id>
<key-many-to-one name="avmStore" class="AVMStoreImpl" column="avm_store_id"/>
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
</composite-id>
<cache usage="read-write"/>
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<many-to-one name="avmStore" class="AVMStoreImpl" column="avm_store_id"/>
<many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
</class>
<class name="AVMNodePropertyImpl" proxy="AVMNodeProperty" table="avm_node_properties">
<composite-id>
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
<key-property name="name" column="qname" type="QName" length="200"/>
</composite-id>
<id name="id" column="id" type="long">
<generator class="native"/>
</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">
<property name="actualType" column="actual_type" type="string" length="15" not-null="true" />
<property name="multiValued" column="multi_valued" type="boolean" not-null="true" />
@@ -183,10 +185,11 @@
</component>
</class>
<class name="AVMStorePropertyImpl" proxy="AVMStoreProperty" table="avm_store_properties">
<composite-id>
<key-many-to-one name="store" class="AVMStoreImpl" column="avm_store_id"/>
<key-property name="name" column="qname" type="QName" length="200"/>
</composite-id>
<id name="id" column="id" type="long">
<generator class="native"/>
</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">
<property name="actualType" column="actual_type" type="string" length="15" not-null="true" />
<property name="multiValued" column="multi_valued" type="boolean" not-null="true" />
@@ -201,10 +204,11 @@
</class>
<!-- Aspect name table for AVM Nodes. -->
<class name="AVMAspectNameImpl" proxy="AVMAspectName" table="avm_aspects">
<composite-id>
<key-many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
<key-property name="name" column="qname" type="QName" length="200"/>
</composite-id>
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<many-to-one name="node" class="AVMNodeImpl" column="node_id"/>
<property name="name" column="qname" type="QName" length="200"/>
</class>
<query name="ChildEntry.ByNameParent">
<![CDATA[