Hello,
I've encountered an issue after upgrading from Tapestry 5.6.4 to 5.7.3.
This included moving from Hibernate 5.1.0.Final to 5.4.32.Final (as per
the guidelines).
The HibernateCrudServiceDAO method below is now failing to fetch named
queries via the injected org.hibernate.Session, resulting in a null
pointer exception when attempting to write parameters to it.
I'm wondering whether this might have something to do with
org.hibernate.Query having been deprecated and replaced with
org.hibernate.query.Query. I understand the tapestry-hibernate package
was reworked around the time of Tapestry 5.7.3 to support changes in
Hibernate.
Incidentally, the issue remains with Tapestry 5.8.2.
Any help/insights would be much appreciated.
Thanks & regards,
Chris.
import org.hibernate.query.Query;
import org.hibernate.Session;
...
@Inject
private Session session;
...
public <T> T findUniqueWithNamedQuery(String queryName, Map<String,
Object> params){
Set<Entry<String, Object>> rawParameters = params.entrySet();
Query query = session.getNamedQuery(queryName);
if(query == null) LOG.error("Oops, Hibernate session returned
null Query object!");
if(query != null) LOG.debug("Query string = " +
query.getQueryString());
for(Entry<String, Object> entry : rawParameters){
LOG.debug("Entry key = " + entry.getKey());
LOG.debug("Entry value = " + entry.getValue().toString());
query.setParameter(entry.getKey(), entry.getValue());
}
return (T) query.uniqueResult();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org