Select hibernate criteria with unmapped entity

1

How do I make a select, using the criteria and bring an unmapped entity, would be multiple joins, and sometimes bring certain fields and others not.

    
asked by anonymous 13.12.2016 / 20:06

1 answer

2

Criteria you can not do without an entity, but you can use Native Query to execute queries.

Query query = session.createSQLQuery("select s.stock_code from stock s where s.stock_code = :stockCode").setParameter("stockCode", "7277");
List result = query.list();

You can view more at: link

    
13.12.2016 / 20:12