Greetings fellow Hibernaters.
I am using HBN 3.2 CR1. I recently discovered that Query by Example does not handle associations (ie collections). I am referring to this
http://www.hibernate.org/hib_docs/refer ... a-examples
sort of QBE usage.
So I'm trying to roll my own QBE that handles associations, and does it generically/dynamically.
Given an example instance that indicates the QBE params, how can I *dynamically* tell that a particular property on that instance is an association? Once I know this, I will .add() the appropriate Restrictions.eq("foo", foo) to my criteria. Nulls are just ignored.
For example: (w/ thanks to Nebob in
http://forum.hibernate.org/viewtopic.ph ... 766d840a9a)
MyFoo foo = new MyFoo();
MyBar bar = new MyBar();
foo.setID(1);
bar.setFoo(foo);
Example ex = Example.create(bar);
List bars = dbSession.createCriteria(bar.getClass())
.add(ex)
.add(Restrictions.eq("foo", foo)
//other association restrictions here
.list();
How can I dynamically tell that the foo property of bar is an association?
I obviously have to utilize some sort of HBN mapping metadata methods in the API, but what/how?
Any advice appreciated.
aj