AVM stores are renamable. Beware. Database schema has changed since I needed to

introduce a synthetic primary key into the stores table.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4492 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-12-02 20:03:20 +00:00
parent 57424368b7
commit b8ff632f15
15 changed files with 169 additions and 6 deletions

View File

@@ -104,8 +104,11 @@
<class table="avm_stores" name="AVMStoreImpl"
proxy="AVMStore" optimistic-lock="version">
<cache usage="read-write"/>
<id name="name" column="name" type="string"/>
<id name="id" column="id" type="long">
<generator class="native"/>
</id>
<version name="vers" column="vers" type="long"/>
<property name="name" column="name" type="string" unique="true"/>
<property type="int" name="nextVersionID"
column="next_version_id" not-null="true"/>
<!-- Every AVMStore has a root directory that is the current root directory. -->

View File

@@ -77,7 +77,10 @@ class AVMStoreDAOHibernate extends HibernateDaoSupport implements
*/
public AVMStore getByName(String name)
{
return (AVMStore)getSession().get(AVMStoreImpl.class, name);
Query query = getSession().createQuery("from AVMStoreImpl st " +
"where st.name = :name");
query.setParameter("name", name);
return (AVMStore)query.uniqueResult();
}
/**
@@ -101,4 +104,12 @@ class AVMStoreDAOHibernate extends HibernateDaoSupport implements
{
// No op in Hibernate.
}
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMStoreDAO#getByID(long)
*/
public AVMStore getByID(long id)
{
return (AVMStore)getSession().get(AVMStoreImpl.class, id);
}
}