JPA QEntity在生成的时候,是用某个词生成的
When JPA QEntity is generated, it is generated with a certain word
我不知道为什么只有名为 "Member" 的实体被编号。
其他实体没有。
附件是 QEntity 源文件。
所以我的问题是
- 为什么编号"Member"实体
- 我不希望它被编号。我应该怎么做才能解决这个问题?
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);
}
}
因为 'member' 是一个 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");
既然您永远不需要在代码中引用它,为什么会出现问题?
我不知道为什么只有名为 "Member" 的实体被编号。
其他实体没有。
附件是 QEntity 源文件。
所以我的问题是
- 为什么编号"Member"实体
- 我不希望它被编号。我应该怎么做才能解决这个问题?
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);
}
}
因为 'member' 是一个 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");
既然您永远不需要在代码中引用它,为什么会出现问题?