Author: d.plentz
Date: 2008-04-26 15:06:18 -0400 (Sat, 26 Apr 2008)
New Revision: 14582
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
Log:
[HHH-1745] Returning resultset from PostgreSQL stored procedure
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java 2008-04-25
22:00:22 UTC (rev 14581)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java 2008-04-26
19:06:18 UTC (rev 14582)
@@ -1,19 +1,21 @@
//$Id: PostgreSQLDialect.java 11367 2007-03-29 13:26:40Z steve.ebersole(a)jboss.com $
package org.hibernate.dialect;
+import java.sql.CallableStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.sql.Types;
-import java.sql.SQLException;
import org.hibernate.Hibernate;
-import org.hibernate.exception.ViolatedConstraintNameExtracter;
-import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
-import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.PositionSubstringFunction;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
+import org.hibernate.exception.JDBCExceptionHelper;
+import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
+import org.hibernate.exception.ViolatedConstraintNameExtracter;
import org.hibernate.id.SequenceGenerator;
/**
@@ -292,8 +294,21 @@
}
}
};
+
+ public int registerResultSetOutParameter(CallableStatement statement, int col) throws
SQLException {
+ // Register the type of the out param - PostgreSQL uses Types.OTHER
+ statement.registerOutParameter(col, Types.OTHER);
+ col++;
+ return col;
+ }
+ public ResultSet getResultSet(CallableStatement ps) throws SQLException {
+ ps.execute();
+ ResultSet rs = (ResultSet) ps.getObject(1);
+ return rs;
+ }
+
// Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// seems to not really...
@@ -309,4 +324,4 @@
// seems to have spotty LOB suppport
return false;
}
-}
+}
\ No newline at end of file
Show replies by date