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.
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.
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