thank you,
the problem was solved,
I use the method,
Code:
session = HibernateSessionFactory.getSession();
DetachedCriteria pointAids = DetachedCriteria.forClass(Point.class)
.setProjection(Property.forName("id")).add(Restrictions.eq("circuit.id", 10055));
DetachedCriteria pointZids = DetachedCriteria.forClass(Point.class)
.setProjection(Property.forName("id")).add(Restrictions.eq("circuit.id", 10055));
List<Link> list = session.createCriteria(Link.class)
.add( Restrictions.or(
Restrictions.in("pointA.id", pointAids.getExecutableCriteria(session).list() ),
Restrictions.in("PointZ.id", pointZids.getExecutableCriteria(session).list() )
))
.list();
and it print 3 sql
Code:
Hibernate:
select
this_.ResPointID as y0_
from
CircuitResPoint this_
where
this_.CircuitID=?
Hibernate:
select
this_.ResPointID as y0_
from
CircuitResPoint this_
where
this_.CircuitID=?
Hibernate:
select
this_.ResLinkID as ResLinkID1_0_,
this_.ResLinkName as ResLinkN2_1_0_,
this_.ResLinkAlias as ResLinkA3_1_0_,
this_.ResLinkDescr as ResLinkD4_1_0_,
this_.ResLinkType as ResLinkT5_1_0_,
this_.ResPointID_A as ResPointID6_1_0_,
this_.ResPointID_Z as ResPointID7_1_0_
from
CircuitResLink this_
where
(
this_.ResPointID_A in (
?, ?, ?, ?, ?, ?, ?, ?, ?
)
or this_.ResPointID_Z in (
?, ?, ?, ?, ?, ?, ?, ?, ?
)
)
but if it has too many items in pointAids or pointZids maybe there will be a problem.