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

How to get all columns of a bean to use in a projection ? #2166(This is an existing problem) #3619

Open
cnlinjie opened this issue Nov 6, 2023 · 1 comment

Comments

@cnlinjie
Copy link

cnlinjie commented Nov 6, 2023

link : #2166
Description:
Hello everybody,

Here is the context :
I have a stupid database constraint that forces me to use a projection to get data from tables using joins conditions that use only one column of composite PKs (so not working with JPA specifications of @OneToMany and @manytoone).
My DBA doesn't want to hear about sequence generated IDs... she is very "old school" about DB modelling... she is in love with composite PKs... :(

So... I want to get all the columns of my main bean, and the other data I need.
Yes, it's simple, and I managed to do it by iterating on every column of my bean, no problem.
Something like that :
Projections.bean(qMainBean, qMainBean.firstField, ..., qOtherBean, qStupidJoinBean)

But here is my problem :
Every time I want to add a new column in my @entity bean, I need to go to modify my query to add that new column in my projection. First, that's annoying, and second, it's not good for maintaining the code.

By searching on StackOverflow and then on QueryDSL documentation, I saw a .all() method on Q generated classes to get all the columns of my bean (that's a great thing !), but I don't have that method generated on my Q classes (that's a bad thing !).

How can I get that method on my Q classes ? Am I missing something ?

My configuration :
Spring Platform Athens-SR5 as "parent" project, so QueryDSL 4.1.4 (and I use all libs in dependencies : core, jpa, collections, codegen, sql and apt)
And for generating Q classes, I use com.querydsl.apt.hibernate.HibernateAnnotationProcessor with jpa and apt libs as dependencies in my POM.

@cnlinjie
Copy link
Author

cnlinjie commented Nov 6, 2023

Although this issue has been mentioned, it has obviously not been resolved. It is a valuable function, so I still hope it can be taken seriously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant