Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYWFlYjViYWRm...
) / New Feature (
https://hibernate.atlassian.net/browse/HHH-16973?atlOrigin=eyJpIjoiYWFlYj...
) HHH-16973 (
https://hibernate.atlassian.net/browse/HHH-16973?atlOrigin=eyJpIjoiYWFlYj...
) optional 'from' clause when result type is an entity class (
https://hibernate.atlassian.net/browse/HHH-16973?atlOrigin=eyJpIjoiYWFlYj...
)
Issue Type: New Feature Assignee: Unassigned Created: 22/Jul/2023 04:31 AM Priority: Major
Reporter: Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Panache lets you omit the from clause on a query method, and Stef thinks this is an
important feature.
So if we want to re-engineer Panache in terms of the new features of the Metamodel
Generator, then we’ll need to add this feature to @HQL methods.
@HQL( "where title like %title" )
List<Book> booksByTitle( String title);
Now, of course, we can have the annotation processor do concatenation on the query string
to achieve this, but that’s a bit ugly and makes error reporting a bit trickier. In
general I want the annotation processor to do as little as possible, and I prefer to make
sure that the things it does can be done via programmatic APIs. Among other motivations,
this means it’s easier to migrate from generated to handwritten code, which is something
I’m focussed on.
So, I propose that we allow things like this:
session.createSelectionQuery( "where title like %title" , Book.class)
.setTitle( "title" , title)
.getResultList()
Where the from Book is implied.
At first I was not very keen on the idea, but after some consideration I believe I’ve
changed my mind. There’s nothing wrong with the code above, and I really do start to see
that argument that from Book is just ceremony here.
Naturally, when the result class is missing, or is not an entity, we would require
explicit from.
(
https://hibernate.atlassian.net/browse/HHH-16973#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16973#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100232- sha1:4329f54 )