【发布时间】:2014-01-30 02:20:17
【问题描述】:
我正在使用 QueryDSL 将我的查询映射到我的 Bean:
QAmbiente qitem=new QAmbiente("x");
SQLTemplates template = new MySQLTemplates(); // SQL-dialect
Configuration configuration = new Configuration(template);
SQLQuery query = new SQLQuery(conn, configuration);
List<Ambiente> items = query.from(qitem).list(Projections.fields(Ambiente.class, qitem.idEmpresa));
我的问题是我有主键的嵌套类,如下所示:
@EmbeddedId
protected AmbientePK ambientePK;
然后当我尝试执行上面的代码时,会抛出一个错误:
The bean of type: br.com.fitsoft.cnfe.model.domain.Ambiente has no property called: idEmpresa
只有当我放置一个作为主键一部分的字段时才会出现问题。
谁能帮帮我? 谢谢
【问题讨论】:
-
您能否举一个正常工作的代码示例(例如,通过使用不属于您的主键的字段)?
-
您能否描述一下您期望的行为?如果 Ambiente 没有 idEmpresa 属性,则无法填充它,就像异常所说的那样。
标签: querydsl