Hibernate criteria by a list of natural ids -



Hibernate criteria by a list of natural ids -

i trying create hibernate criteria using list of natural ids. saw illustration here http://docs.jboss.org/hibernate/core/3.5/reference/en-us/html/querycriteria.html#query-criteria-naturalid shows illustration querying single record:

session.createcriteria(user.class) .add(restrictions.naturalid() .set("name", "gavin") .set("org", "hb"));

is there improve way create criteria list of natural ids illustration below?

junction junction = restrictions.disjunction() .add(restrictions.naturalid() .set("name", "gavin") .set("org", "hb")) .add(restrictions.naturalid() .set("name", "jdoe") .set("org", "rh")); session.createcriteria(user.class) .add(junction);

thanks.

in experience, no. reason due limitations of sql in implementations. when seek phrase in sql gets tricky...

pseudo sql isn't cross db supported...

select * table (name, org) in values ( ('gavin', 'hb'), ('jdoe', 'hr'))

what hibernate ends writing mutual cross db way of...

select * table (name = 'gavin' , org = 'hr') or (name = 'jdoe' , org = 'hr')

i have upvoted question , added favorites track in hopes wrong , there improve way. know in db2 zos oddity causes optimizer create poor choices.

hibernate criteria

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -