2013-08-29 92 views
1

工作時,我有一個實體標註爲錯誤類型的枚舉上querydsl

@Enumerated(EnumType.ORDINAL) 
private CommentStatus cd_status = CommentStatus.DEFAULT; 

我的Q類產生

public final EnumPath<CommentStatus> cd_status = createEnum("cd_status", CommentStatus.class); 

用下面的語句:

QCommentEntity tableComment = QCommentEntity.commentEntity; 
EnumPath<CommentStatus> o = tableComment.cd_status; 

我得到這個編譯時出錯tableComment.cd_status

Type mismatch: cannot convert from NumberPath<Integer> to EnumPath<CommentStatus> 

Er,NumberPath?這是EnumPath類型。 WAT?

我對querydsl內部沒有任何經驗。這是爲什麼發生?

Querydsl 3.2.2

編輯1:
$ mvn dependency:tree -Dverbose -Dincludes=com.mysema.querydsl

+- com.mysema.querydsl:querydsl-jpa:jar:3.2.2:compile 
[INFO] | \- com.mysema.querydsl:querydsl-core:jar:3.2.2:compile 
[INFO] \- com.mysema.querydsl:querydsl-apt:jar:3.2.2:provided 
[INFO] \- com.mysema.querydsl:querydsl-codegen:jar:3.2.2:provided 
[INFO]  \- (com.mysema.querydsl:querydsl-core:jar:3.2.2:provided - omitted for duplicate) 

使用querydsl-jpa-3.2.2-apt-hibernate-one-jar.jar月食Q類代

+0

其他一些人在類路徑依賴關係不一致時遇到此錯誤。你有沒有APT世代的工作建設? –

+0

我刪除了有問題的Q類,並運行了Maven構建,錯誤得到修復。我再次刪除它並強制APT生成(再次重現錯誤),錯誤被修復了¬¬。真的,去了解日食。現在我不知道發生了什麼,有什麼線索? –

+0

我自己沒有經歷過這個,但是有一些其他的Querydsl用戶。看起來APT處理器(代碼生成)在存在類路徑問題時無法獲得正確的數據。 APT錯誤掩蓋其他問題。 –

回答

0

原來是某種類路徑問題。
由於問題的不可預測性,我無法確切地確定原因。