I'm trying to create a table that has a a unique constraint that consists of multiple columns. After some time i found <properties> and when i use it then i get the correct unique constraint. But the code no longer runs when i try to read some objects using the Criteria API. When the properties are define "as usual" everything works fine, when i wrap them int a <properties> element then hibernate complains that it cannot find the property. Does anyone have a small hint for me?
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="test">
    <class name="Test" table="TEST" lazy="false">    
        <id name="myID" column="ID" access="field">
         <generator class="uuid"/>
        </id>      
      
      <properties name="someName" unique="true">
         <property name="myName" type="string" column="name" access="field" not-null="true"/>      
         <property name="myDomain" type="string" length="16" column="domain" access="field" not-null="true"/>         
      </properties>
      
    </class>         
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
package test;
public class Test
{
   private String myID;
   private String myName;
   private String myDomain;
}
Criteria loCriteria = loSession.createCriteria(Test.class);
               loCriteria.add(Restrictions.eq("myName", "aaa"));               
               return (Test) loCriteria.uniqueResult();
Full stack trace of any exception that occurs:Code:
 org.hibernate.QueryException: could not resolve property: myName of: test.Test
   at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
   at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
   at org.hibernate.persister.entity.BasicEntityPersister.getSubclassPropertyTableNumber(BasicEntityPersister.java:1111)
   at org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:31)
   at org.hibernate.persister.entity.BasicEntityPersister.toColumns(BasicEntityPersister.java:1086)
   at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:403)
   at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumnsUsingProjection(CriteriaQueryTranslator.java:369)
   at org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:42)
   at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:314)
   at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1303)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)
   at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:433)