Hello All
I think within HibernateTemplate has one bug in load method, when I call load method with Composite PrimaryKey in ID, the return object is null, with HibernateObjectRetrievalFailureException Exception. but a ensure that ID is with valid data.
Here the code where a call the above methodCode:public Object retrieve(Object dataObject, Serializable id) { try { if (dataObject != null && id != null) { HibernateTemplate template = new HibernateTemplate (getSessionFactory()); retorno = template.load(dataObject.getClass(),id); } } catch (HibernateObjectRetrievalFailureException e) { retorno = null; } catch (Exception e) { e.printStackTrace(); } return retorno; }
Code:VendedorClientePOPK vendedorClientePK = new VendedorClientePOPK(); VendedorClientePO vendedorCliente = new VendedorClientePO(); vendedorClientePK.setCodCliente( Util.getCnpj(nrCgc,nrFil,nrDc) ); vendedorClientePK.setCodVendedor(codVendedor); VendedorClientePO vc = (VendedorClientePO) getGenericDao().retrieve(vendedorCliente, vendedorClientePK);


Reply With Quote