Hibernate version:
Hibernate 3.1.2
Code between sessionFactory.openSession() and session.close():
Criteria crit = getSession().createCriteria(getPersistentClass());
Example example = Example.create(exampleInstance);
if(excludeProperty != null)
{
for (String exclude : excludeProperty)
{
example.excludeProperty(exclude);
}
}
crit.add(example);
return crit.list();
Name and version of the database you are using:
MS SQL Server 2000
When using Hibernates Query By Example functionality, composition classes are ignored in the example.
i.e. Given the 2 domain instances:
1st Instace
User user (int id(pk)=1, String name="test", Realm realm1(fk to Realm))
Realm realm1 (String id(pk)="testRealm1", String description="Test Realm 1")
2nd Instance
User user (int id(pk)=2, String name="test", Realm realm2(fk to Realm))
Realm realm2 (String id(pk)="testRealm2", String description="Test Realm 2")
The following example returns both, even though the realms are different:
User user(String name="test" Realm realm1) user
Realm realm1(String id="testRealm1")
It appears that the composed class Realm is ignored in the QBE process. This happens even if the realm specifies the description as well as the id, so the problem is not due to primary keys being ignored in the QBE process.
Should I raise this as a JIRA issue?
_________________ Jamie Cash
eCommerce Consultancy Limited
The eSecurity Experts
|