Bonjour,
je désire faire une simple requete par l'exmple qui me renvoit les occurences qui correspondent : (à noter que j'utilise Spring)
Code:
Balance b = new Balance();
b.setBalanceDate(date);
b.setAccount(anAccount);
getHibernateTemplate().execute(new HibernateCallback()
{
public Object doInHibernate(Session session) throws HibernateException
{
Example ex = Example.create(b);
return session.createCriteria(Balance.class).add(ex).uniqueResult();
}
});
Je crée donc une objet Balance avec deux attributs sur lesquels je veux me baser pour ma recherche.
Le problème est que hibernate ne semble faire la recherche que sur l'attribut date, l'objet account semble être ignoré
Je joins le mapping de Balance
Quote:
<hibernate-mapping
>
<class
name="com.planaxis.swifter.model.Balance"
table="BALANCE"
>
<id
name="idBalance"
column="ID_BALANCE"
type="java.lang.Long"
>
<generator class="increment">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Balance.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<many-to-one
name="account"
class="com.planaxis.swifter.model.Account"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="ID_ACCOUNT"
not-null="true"
/>
<property
name="balanceAmount"
type="java.lang.Float"
update="true"
insert="true"
column="BALANCE_AMOUNT"
/>
<property
name="balanceDate"
type="java.util.Date"
update="true"
insert="true"
column="BALANCE_DATE"
/>
</class>
</hibernate-mapping>
Hibernate version: 3