Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Hibernate 3.2
Mapping documents:
<sql-query name="selectAllProductGroups" callable="true">
<return alias="dept" class="no.smc.entity.ProductGroup">
<return-property name="pgrId" column="PGR_ID"/>
</return>
{ call changeAllDiffProdGroup(?,?,?,?,?) }
</sql-query>
Code between sessionFactory.openSession() and session.close():
Query q=session.getNamedQuery("no.smc.entity.ProductGroup.selectAllProductGroups");
q.setString(0,dgr);
q.setString(1,pgr);
q.setString(2,text);
q.setFloat(3,updatedDifference);
q.setInteger(4,productMngrId);
q.executeUpdate();
samproductGroupList=q.list();
Full stack trace of any exception that occurs:
org.hibernate.exception.GenericJDBCException: could not execute query
Name and version of the database you are using:
Mysql 5.0
Stored procedure
delimiter //
DROP PROCEDURE IF EXISTS changeAllDiffProdGroup;
//
delimiter //
create procedure changeAllDiffProdGroup(IN filterDgr VARCHAR(3),IN filterPgr VARCHAR(6),IN filterText VARCHAR(255),IN diffpgroup NUMERIC(3,1),IN prodmgrid INTEGER )
begin
DECLARE fDgr VARCHAR(3);
DECLARE fPgr VARCHAR(6);
DECLARE fText VARCHAR(255);
set fDgr=CONCAT(filterDgr,"%");
select fDgr;
set fPgr=CONCAT(filterPgr,"%");
select fPgr;
set fText=CONCAT(filterText,"%");
select fText;
call changeAllFilterDiffProdGroup(fDgr,fPgr,fText,diffpgroup,prodmgrid );
SELECT PGR_ID FROM PRODUCT_GROUP AS PG,DISCOUNT_GROUP AS DG WHERE PG.DGR_ID=DG.DGR_ID AND DG.DGR LIKE filterDgr AND PG.PGR LIKE filterPgr AND PG.TEXT LIKE filterText AND DG.PROD_MNGR_ID=prodmgrid;
end; //
delimiter ;
[
The error
If we call the prepared statement , the procedure gets executed and the
database gets updated. There is no exception being thrown. But when we try
to refresh the session cache by doing a HQL query it throws a GenericJDBCException