简体   繁体   中英

QUERYDSL: Unable to get query type for primary key in the inherited entity

All the entities I have inherit a parent class whose role is to generate the primary key. However when I'm trying to join two tables something like this from the documentation

 query.from(customer)
 .leftJoin(company).on(customer.company.eq(company.id))
.list(customer.firstName, customer.lastName, company.name);

However I do not have the Id field in generated query types. Is there any alternative rather than using native queries as I also have filters which are dynamically generated as BooleanExpression which I want to pass in where clause.

You need a @MappedSuperclass in you parent/super-class

If you derive from more than one super-class, you MUST tag all the super-classes with @MappedSuperclass to get the inherited fields. This is mandatory for QueryDSL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM