Hi there,
Im having a problem with getting native SQL to work with a count query. I get the following error message:
net.sf.hibernate.MappingException: No persister for: java.lang.Integer
The method causing the problem is this ultimately this one:
createSQLQuery(getCountQuery(), "a", Integer.class);
I then have some more code which is supposed to make use of the number (returned as an Integer) returned from the query.
The SQL query to run is this one:
SELECT DISTINCT COUNT(*) FROM cks_group a, cks_group_fti f1 WHERE f1.string ~'^stuff' AND a.oid=f1.id;
The stuff after the WHERE is postgreSQL specific Free Text Searching stuff, which is why we have to use native SQL, as Hibernate doesnt currently support using underlying free text searching facilities.
One thing to note is that the return alias never actually appears in the query and isnt needed really (?), however leaving this as "null" simply results in the same error message anyway.
Does anyone know why this exception is being thrown?
Jon
|