So, this is an idea. I wanted to get a feel for what people think of it before I submit a ticket.
When using the criteria API, why are the objects you pass as criteria validated? For instance:
Code:
SomeOtherObject other = new SomeOtherObject();
other.setId(35);
Criteria criteria = session.createCriteria(MyObject.class);
criteria.add(Restrictions.eq("otherObject", other));
criteria.list();
If the SomeOtherObject instance has a required property, name, this will throw an exception "not-null property references null value...". To me, this doesn't make much sense. It seems like if I'm just building a query essentially, why require the objects used as criteria to be completely valid? They're not going to be persisted so why validate them?