Skip to content

MongoAnnotationProcessor does not take under account field mapping annotations [DATAMONGO-1488] #2369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Sep 8, 2016 · 2 comments
Assignees
Labels
in: repository Repositories abstraction type: bug A general bug

Comments

@spring-projects-issues
Copy link

Evangelos Parchas opened DATAMONGO-1488 and commented

org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor does not take under account @Field annotations (or any other field mapping annotation) when generating Querydsl query types.

For example, given the model:

@QueryEntity
@Document(collection = "connections")
public class Connection {
    @Id
    private String id;

    @Field("ts")
    private Long resendTs;
}

The generated Querydsl query type is:

@Generated("com.querydsl.codegen.EntitySerializer")
public class QConnection extends EntityPathBase<Connection> {
    private static final long serialVersionUID = -135104363L;

    private static final PathInits INITS = PathInits.DIRECT2;

    public static final QConnection connection = new QConnection("connection");

    public final StringPath id = createString("id");

    public final NumberPath<Long> resendTs = createNumber("resendTs", Long.class);
}

and when executing query with:

QConnection qConnection = QConnection.connection;
connectionRepository.findAll(qConnection.resendTs.gt(System.currentTimeMillis()));

the generated condition contains "resendTs" instead of "ts"


Affects: 1.9.2 (Hopper SR2)

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

Any chance you provide an example that is not working? I can clearly see SpringDataMongodbSerializer.getKeyForPath(…) looking up the field name on out entity meta-model

@spring-projects-issues
Copy link
Author

Evangelos Parchas commented

Hello Oliver,

This seems to be a mistake from my side. I repeated the test and could not reproduce it.

Thanks for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: repository Repositories abstraction type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants