-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Idea: Why validate objects passed to the criteria API?
PostPosted: Fri Dec 19, 2008 10:32 am 
Beginner
Beginner

Joined: Wed Dec 17, 2008 12:10 pm
Posts: 47
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.