You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQLExtractor.from(TypedQuery) didn't work from some of my use cases: for some reason, I got a proxy for my TypedQuery instance, which isn't assignable from QuerySqmImpl.
I could solve it with following workaround:
private Query getHibernateQuery(TypedQuery<?> typedQuery) {
try {
if (typedQuery instanceof QuerySqmImpl) {
return typedQuery;
}
// is proxyied, get it out
InvocationHandler invocationHandler = Proxy.getInvocationHandler(typedQuery);
Class<?> innerClass = invocationHandler.getClass();
Field targetField = innerClass.getDeclaredField("target");
targetField.setAccessible(true);
return (Query) targetField.get(invocationHandler);
} catch (NoSuchFieldException | IllegalAccessException exception) {
throw new RuntimeException(exception);
}
}
I suggest including it in SQLExtractor.
The text was updated successfully, but these errors were encountered:
SQLExtractor.from(TypedQuery)
didn't work from some of my use cases: for some reason, I got a proxy for my TypedQuery instance, which isn't assignable from QuerySqmImpl.I could solve it with following workaround:
I suggest including it in SQLExtractor.
The text was updated successfully, but these errors were encountered: