我不知道为什么只有名为“ Member”的实体被编号。
其他实体没有。
附加的是QEntity源。
所以我的问题是
import static com.querydsl.core.types.PathMetadataFactory.*;
import com.querydsl.core.types.dsl.*;
import com.querydsl.core.types.PathMetadata;
import javax.annotation.Generated;
import com.querydsl.core.types.Path;
/**
* QMember is a Querydsl query type for Member
*/
@Generated("com.querydsl.codegen.EntitySerializer")
public class QMember extends EntityPathBase<Member> {
private static final long serialVersionUID = -1377787676L;
public static final QMember member = new QMember("member1"); //why numbering...
public final NumberPath<Integer> memberIdx = createNumber("memberIdx", Integer.class);
public QMember(String variable) {
super(Member.class, forVariable(variable));
}
public QMember(Path<? extends Member> path) {
super(path.getType(), path.getMetadata());
}
public QMember(PathMetadata metadata) {
super(Member.class, metadata);
}
}
答案 0 :(得分:0)
因为“成员”是JPQL关键字。
https://docs.oracle.com/html/E13946_04/ejb3_langref.html#ejb3_langref_collection_member
QueryDsl包含这些列表,并通过添加数字后缀对它们进行转义:
http://www.querydsl.com/static/querydsl/4.1.4/apidocs/index.html?com/querydsl/codegen/Keywords.html
public static final Collection<String> JPA = ImmutableList.of(
"ABS","ALL","AND","ANY","AS","ASC","AVG","BETWEEN",
"BIT_LENGTH[51]","BOTH","BY","CASE","CHAR_LENGTH",
"CHARACTER_LENGTH","CLASS",
"COALESCE","CONCAT","COUNT","CURRENT_DATE","CURRENT_TIME",
"CURRENT_TIMESTAMP",
"DELETE","DESC","DISTINCT","ELSE","EMPTY","END","ENTRY",
"ESCAPE","EXISTS","FALSE","FETCH",
"FROM","GROUP","HAVING","IN","INDEX","INNER","IS","JOIN",
"KEY","LEADING","LEFT","LENGTH","LIKE",
"LOCATE","LOWER","MAX","MEMBER","MIN","MOD","NEW","NOT",
"NULL","NULLIF","OBJECT","OF","OR",
"ORDER","OUTER","POSITION","SELECT","SET","SIZE","SOME",
"SQRT","SUBSTRING","SUM","THEN",
"TRAILING","TRIM","TRUE","TYPE","UNKNOWN","UPDATE","UPPER",
"VALUE","WHEN","WHERE");
鉴于您无需在代码中引用它,为什么会出现问题?