can i have something like this?
A, B & C is tables that i wanted to join.
column a1, & a2 belongs to table A.
column b1 belongs to table B.
column c1, c2, c3 belongs to table C.
Code:
list = session.createCriteria(A.class)
.add(Restrictions.eq("a1", no))
.add(Restrictions.eq("a2", name))
.setFetchMode("B",FetchMode.JOIN)
.add(Restrictions.eq("b1", venId))
.setFetchMode("C",FetchMode.JOIN)
.add(Restrictions.eq("c1", new Boolean(false)))
add(Restrictions.eq("c2", IXConstant.STATUS_ACTIVE))
.add(Restrictions.eq("c3", spCatSelected))
.list();
The mapping
<class name="A" table="A">
<id name="partId" column="partId" type="long">
<generator class="identity"/>
</id>
<property name="a1" type="string">
<column name="a1" length="10" not-null="true" unique="true"/>
</property>
<property name="a2" type="string">
<column name="a2" length="2000" not-null="true"/>
</property>
<many-to-one name="C" class="C" column="categoryId"/>
<set name="B"cascade="all" inverse="true">
<key column="partId"/>
<one-to-many not-found="ignore" class="B"/>
</set>
</class>
The performance is still quite slow, how can i further enhance the query in order to have a better performance?