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

Projection of SQL query onto JPA entities and aliases #540

Closed
msiedlarek opened this issue Nov 4, 2013 · 3 comments
Closed

Projection of SQL query onto JPA entities and aliases #540

msiedlarek opened this issue Nov 4, 2013 · 3 comments
Labels
Milestone

Comments

@msiedlarek
Copy link
Contributor

@msiedlarek msiedlarek commented Nov 4, 2013

Projection of SQL query onto JPA entities relies on alias naming and there's not a word in the reference about it.

In the documentation there's this example code:

SAnimal cat = new SAnimal("cat");   
QCat catEntity = QCat.cat;    
List<Cat> cats = query.from(cat).orderBy(cat.name.asc()).list(catEntity);

It did not occur to me that this naming convention was necessary and I have gone through the entire process of coding, frustration and debugging to discover it.

If this behaviour is really best we can have (I believe it to be quite counterintuitive, as QueryDSL mostly handles aliases and paths not relaying on any names) maybe it should be documented accordingly, like:

QCat catEntity = QCat.cat;    
SAnimal cat = new SAnimal(catEntity.getMetadata().getName());   
@timowest
Copy link
Member

@timowest timowest commented Nov 5, 2013

I'd prefer to keep the original code example and add some documentation.

Mixing table and entity based Querydsl paths is what makes this example a bit tricky. And paths are unified by name at the serialization level.

I am not sure if this is counter-intuitive and I am not sure if there are good alternatives.

timowest added a commit that referenced this issue Nov 6, 2013
@msiedlarek
Copy link
Contributor Author

@msiedlarek msiedlarek commented Nov 8, 2013

Looks ok, thanks!

@timowest
Copy link
Member

@timowest timowest commented Nov 17, 2013

Released in 3.3.0.BETA1

@timowest timowest closed this Nov 17, 2013
@timowest timowest added this to the 3.3.0 milestone Apr 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants