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

return type of createNativeQuery(String, Class) #52

Open
lukasj opened this issue Mar 20, 2013 · 9 comments
Open

return type of createNativeQuery(String, Class) #52

lukasj opened this issue Mar 20, 2013 · 9 comments

Comments

@lukasj
Copy link
Contributor

lukasj commented Mar 20, 2013

Hi,

I've got a minor suggestion:

EntityManager.createNativeQuery(String, Class)

could return a TypedQuery as the result class is specified:

TypedQuery<T> createNativeQuery(java.lang.String sqlString, java.lang.Class<T> resultClass)

-Adrian

@lukasj
Copy link
Contributor Author

lukasj commented Mar 20, 2013

@glassfishrobot Commented
Reported by agoerler

@lukasj
Copy link
Contributor Author

lukasj commented May 5, 2014

@glassfishrobot Commented
edvin said:
Is there a more complex underlying reason for this not being fixed? At first glance it seems trivial.

@lukasj
Copy link
Contributor Author

lukasj commented Nov 28, 2016

@glassfishrobot Commented
hirdil said:
It would be nice to have this feature.

@lukasj
Copy link
Contributor Author

lukasj commented Nov 29, 2016

@glassfishrobot Commented
neilstockton said:
You mean, apart from the fact that there already is a method
createNativeQuery(String sqlString, Class resultClass)

returning Query. So for backwards compatibility you can't just change the signature. Unless backwards compatibility is thrown away of course ...

@lukasj
Copy link
Contributor Author

lukasj commented May 5, 2017

@glassfishrobot Commented
This issue was imported from java.net JIRA JPA_SPEC-52

@lukasj
Copy link
Contributor Author

lukasj commented Aug 31, 2018

@m-reza-rahman
Copy link

I don't think this is possible without breaking backwards compatibility and this seems very minor. I suggest just closing it to reduce clutter.

Reza Rahman
Jakarta EE Ambassador, Author, Blogger, Speaker

Please note views expressed here are my own as an individual community member and do not reflect the views of my employer.

@gavinking gavinking changed the title createNativeQuery(String, Class) return type of createNativeQuery(String, Class) Aug 15, 2023
@gavinking
Copy link
Contributor

I think we should not do anything about this issue for now, but I do think it's something we should circle back to later, probably at the same time we look at #9.

Changing the return type of the method from Query to its subtype TypedQuery is a breaking change, but it's the most innocuous sort of breaking change, and it's mostly source-compatible. So I think it's the sort of change we could quite safely make in the next major version (i.e. 4.0).

On the other hand, depending on how we do #9, it's remotely possible that this change won't be necessary after all.

@gavinking gavinking added the candidate-for-4 Good candidate for JPA 4 label Aug 23, 2023
@lprimak
Copy link

lprimak commented Aug 28, 2023

I support this for being included in 4 as well.
In the meantime, will continue using https://docs.flowlogix.com/#section-nativequery for this functionality

gavinking added a commit to gavinking/persistence that referenced this issue Nov 3, 2023
lukasj pushed a commit that referenced this issue Nov 3, 2023
gavinking added a commit to gavinking/persistence that referenced this issue Sep 20, 2024
finally fixes ancient issue jakartaee#52

Signed-off-by: Gavin King <gavin@hibernate.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants