3
我正在MySql中针对World数据库测试QueryDSL。我可以将数据作为List检索,但我无法将其作为List返回。我通过SQL查询,没有别的。这是我的。QueryDSL简单查询不会转换为对象
private void getSomething(Connection connection) {
QCountry country = QCountry.country;
SQLTemplates dialect = new HSQLDBTemplates();
SQLQuery query = new SQLQueryImpl(connection, dialect);
//List<Object[]> countries = query.from(country).list(country.all());
List<QCountry> countries = query.from(country).list(country);
System.out.println(countries);
try {
connection.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
我得到这个错误: java.lang.IllegalArgumentException: RelationalPath based projection can only be used with generated Bean types