I wrote a PostgreSQL function with return value VOID:
CREATE OR REPLACE FUNCTION queryinteriorexteriorcount()
RETURNS void AS .....
The function works quite well if i call it in pgAdmin. But if i try to call it out from hibernate it wont work, i'll just get the
failed.org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111
I created an own dialect and registered my function:
public class PostgisDialect extends PostgisDialect {
private static final long serialVersionUID = 3397563913838305367L;
public PostgresDialect(){
registerFunction("queryinteriorexteriorcount", new StandardSQLFunction("queryinteriorexteriorcount"));
}
}
Then i changed the dialect in my hibernate.cfg.xml
<property name="dialect">at.opendata.hibernate.PostgresDialect</property>
And here is how i want to call it:
Query query = session.createSQLQuery("SELECT queryinteriorexteriorcount()");
query.uniqueResult();
Can you please tell me how i can call this function? I dont expect any return value, i just want to call it, the function would do all on itself.
void
into something it can understand and failing. Give it a dummy return value? Or see if you can get Hibernate to discard the results - does it have a query operation to execute the function and ignore the result, likeexecuteUpdate
or similar? See also: stackoverflow.com/q/12557957/398670 – Craig Ringer Jun 2 at 14:46