Turned out to be some kind of classpath issue.
I could not identify exactly the cause due to the unpredictable nature of the problem.
Wrong types when working with enum on querydsl
Question
I have an entity annotated as
@Enumerated( EnumType.ORDINAL )
private CommentStatus cd_status = CommentStatus.DEFAULT;
My Q class generates
public final EnumPath<CommentStatus> cd_status = createEnum("cd_status", CommentStatus.class);
With the following statement:
QCommentEntity tableComment = QCommentEntity.commentEntity;
EnumPath<CommentStatus> o = tableComment.cd_status;
I get this error at compile time on tableComment.cd_status
:
Type mismatch: cannot convert from NumberPath<Integer> to EnumPath<CommentStatus>
Er, NumberPath? This is EnumPath type. WAT?
I have zero experience with querydsl internals. Why is this happening?
Querydsl 3.2.2
EDIT 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)
Using querydsl-jpa-3.2.2-apt-hibernate-one-jar.jar
for eclipse Q class generation
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow