I have 2 tables 'Stock' and 'stockdaily' Need to fetch all the
"stock_template" from stock where stock_status=true
and stock.stock_template is the FK to Stockdaily.stock_template.
Right now I am doing this
I wrote in Stockdaily.hbm.xml
<many-to-one class="StockDTO" column="stock_template" name="templates"/>
In StockdailyDTO.java
private StockDTO templates;
In StockDTO
private Boolean stocktemplate;
In Stock.hbm.xml
<property name="stockStatus" type="java.lang.Boolean">
<column name="stock_Status" />
</property>
but whenever I try to fetch data on the basis of restriction stock_statua=true
criteria = session.createCriteria(stockDailyDTO.class).add( Restrictions.eq("templates.stockStatus", true) );
System gives an exception that
org.hibernate.QueryException: could not resolve property: templates.stockStatus of: StockdailyDTO
Can anyone tell me what else should I do to resolve this issue?