Hi,
mladen.babic wrote:
Hi,
from ITEM i, BID b where i.producttype.name = b.producttype.name
Have you tried something like this - you basically can join tables via the Criteria API using the following syntax:
Code:
session.createCriteria(Item.class)
.createAlias("bids", "b")
.add( Restriction.eq("producttype.name" = "b.producttype.name"));
Quote:
and second question is :
How can I represent this dinamic sql with Criteria ?
Code:
stringQuery="ProductEntity list where"
if(distributors!=null && !distributors.isEmpty()){
for(Warehouse warehouse:distributors){
stringQuery.append(" list.distributors like '");
stringQuery.append("%");
stringQuery.append(warehouse.getId());
stringQuery.append("%' or ");
}
Not sure what you mean, but in case your problem is how to use a like query in the Criterion API have a look at
Restrictions.like.
--Hardy