Skip to content
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

Take @Table/@Column annotations into account in JPA native queries #926

johnktims opened this issue Sep 5, 2014 · 2 comments

Take @Table/@Column annotations into account in JPA native queries #926

johnktims opened this issue Sep 5, 2014 · 2 comments


Copy link

@johnktims johnktims commented Sep 5, 2014

I'm generating Q classes from JPA entities using the maven JPAAnnotationProcessor. Normally, I use JPAQuery and everything works but I needed to UNION two queries so I tried to use JPASQLQuery.

Entities with names that map directly to its corresponding table work fine but if it's different then the "table is not found".


class User

works fine but

class User

will still try to generate SQL that refers to a table named User and fail.

Copy link

@timowest timowest commented Sep 30, 2014

Released in 3.5.0

Copy link

@schragmanuel schragmanuel commented Nov 17, 2015

I'm seeing a problem related to this in Version 3.6.9:

My entity has a many to one relation to another entity:

@javax.persistence.ManyToOne(targetEntity = ch.ims.suisdata.core.model.address.Address.class)
@javax.persistence.JoinColumn(name = "NADR_ID", nullable = true, updatable = false, insertable = false)
private Address address;

When i try to do a join, the on part is not mapped to the foreign key column:

new JPASQLQuery(em, new OracleTemplates()).from(qEntity).leftJoin(qAddress).on(qEntity.address.eq(qAddress.));

This results in the query:

select ... left join ADRESSEN address on errorView.address = address

but it should be

select ... left join ADRESSEN address on errorView.NADR_ID = address.NID

I'm not sure if I do something wrong in the syntax of the query or if it's a QueryDsl issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.