Finder def
@RooJpaActiveRecord(finders = {"findIndividualJobsByIndividualAndIndividualJobType"})
模型字段
@Enumerated(EnumType.STRING)
@ElementCollection(targetClass=IndividualJobType.class)
private List<IndividualJobType> individualJobType;
Roo正在生成这个Finder,它混合了String&amp; StringBuffer的
public static TypedQuery<IndividualJob> IndividualJob.findIndividualJobsByIndividualAndIndividualJobType(Individual individual, List<IndividualJobType> individualJobType, String sortFieldName, String sortOrder) {
if (individual == null) throw new IllegalArgumentException("The individual argument is required");
if (individualJobType == null) throw new IllegalArgumentException("The individualJobType argument is required");
EntityManager em = IndividualJob.entityManager();
StringBuilder queryBuilder = new StringBuilder("SELECT o FROM IndividualJob AS o WHERE o.individual = :individual AND");
for (int i = 0; i < individualJobType.size(); i++) {
if (i > 0) queryBuilder.append(" AND");
queryBuilder.append(" :individualJobType_item").append(i).append(" MEMBER OF o.individualJobType");
}
if (fieldNames4OrderClauseFilter.contains(sortFieldName)) {
jpaQuery = jpaQuery + " ORDER BY " + sortFieldName;
if ("ASC".equalsIgnoreCase(sortOrder) || "DESC".equalsIgnoreCase(sortOrder)) {
queryBuilder.append(" " + sortOrder);
}
}
TypedQuery<IndividualJob> q = em.createQuery(queryBuilder.toString(), IndividualJob.class);
q.setParameter("individual", individual);
int individualJobTypeIndex = 0;
for (IndividualJobType _individualjobtype: individualJobType) {
q.setParameter("individualJobType_item" + individualJobTypeIndex++, _individualjobtype);
}
return q;
}
其他非Enum ElementCollections正确生成。
有什么想法吗?
答案 0 :(得分:1)
我认为你发现了一个错误。你可以在https://jira.spring.io/browse/ROO/上报告一下吗? (谢谢!)
另一方面,解决方法可能是 push-in .java 中的方法并修复 手工编写代码(这是Roo的一个重点,你不会被它生成的代码链接起来;-))
祝你好运!