简体   繁体   中英

QueryDSL It's possible usage of abstract Class methods in generated classes?

It's possible to use queryDSL generated classes to refer abstract methods from class?

Here is a example:

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
class A {
    @Id private Long id;

    public getId/setId;
    protected abstract Date finalDate();
}

@Entity
class B extends A {
    private Date finalDate;

    public getFinalDate/setFinalDate;
}

@Entity
class C extends A {
    private B b;

    public getFinalDate(){return b.getFinalDate());
}

I would like to use a query like this:

new JPAQuery<A>(em)
.select(a)
.where(a.finalDate.isNotNull())
.fetch();

But after build phase (Construct meta classes), the generated A class (QA.class), doesn't has nothing like.

JB Nizets comment is the answer:

No the query needs to be translated to SQL, and executed by the database. The database doesn't know and care about your classes and methods. All it knows about is its tables and columns. – JB Nizet 10 hours ago

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