java - Hibernate Criteria API join through id -


when using criteria api, in order add filters entity referenced current one, use code:

criteria.createalias("customer", "customer", criteria.inner_join); 

where customer customer entity property in entity criteria created for. problem is, need remove referenced entity , leave it's id in class, i.e. replace

@manytoone @joincolumn(name = "id_customer") private customerentity customer; 

by

@column(name = "id_customer") private long customerid; 

so, change need make in criteria alias in order keep working? filter example have on it, along join above:

criteria.add(restrictions.eq("customer.statusid", statusid)); 


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -