Hello!
I have the following class:
Code:
public class House {
private Long codHouse;
private Boolean destack;
private Date dateInclusion;
// getters e setters
}
And running a query using Criteria just want to get the code and the destack value (true or false):
Code:
public List<House> listDestacks() {
return session.createCriteria(House.class)
.add(Restrictions.isNotNull("destack"))
.setProjection(Projections.projectionList()
.add(Projections.property("codHouse").as("codHouse"))
.add(Projections.property("destack").as("destack")))
.addOrder(Order.desc("dateInclusion")).setMaxResults(10).list();
}
Except that the query is not working to get the field
"destack":Code:
Hibernate:
select
this_.cod_house as y0_,
this_.destack as y1_
from
House this_
where
y1_ is not null
order by
this_.date_inclusion desc limit ?
16:39:40,668 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 42703
16:39:40,668 ERROR [JDBCExceptionReporter] ERRO: column "y1_" does not exist
Position: 79
can anyone help?
Thanks!!