Hibernate Query Restriction: NULL or Trim Whitespace Empty-String -


added child-table issue

one of hibernate query restrictions either null or trimmed-empty string.

the following or-restriction trim(..) doesn't work because it's not sqlrestriction.

final criteria query = sessionfactory.getcurrentsession().createcriteria(peoplet.class);  query.add(restrictions.or(       restrictions.eq("trim(childtable.commenttext)",""),       restrictions.isnull("childtable.commenttext")) ); 

the error is

org.hibernate.queryexception: not resolve property: trim( 

but can have 1 or part sqlrestriction , other plain restriction? way handle test? note: have child table here.

try this:

add(restrictions.sqlrestriction("{alias}.trimcommenttext) = ?", ""), stringtype.instance)) 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -