return type of createNativeQuery(String, Class)
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
- Issue Imported From: https://github.com/javaee/jpa-spec/issues/52
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @ldemichiel
@glassfishrobot Commented Reported by agoerler
@glassfishrobot Commented edvin said: Is there a more complex underlying reason for this not being fixed? At first glance it seems trivial.
@glassfishrobot Commented hirdil said: It would be nice to have this feature.
@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 ...
@glassfishrobot Commented This issue was imported from java.net JIRA JPA_SPEC-52
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.
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.
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