Hibernate +

0 respostas
monike

Bom dia Galera!
Estou com um problema sério.Tenho uma query nativa ,mas quando eu dou um inspect pra ver o que tem dentro do objeto ele nao consegue me mostrar os dados.Como faço pra ele reconhecer esse objeto e mostrar o resultado correto?Se alguém tiver alguma ideia..

obrigada

public Collection<UnidadeOrganizacional> obterTodosSetores(UnidadeOrganizacional unidade,String sigla) throws AplicacaoException{
		Session session = SessionFactoryCorporativo.getInstance().getCurrentSession();
		Collection<UnidadeOrganizacional> lista = null;
		
		try {
			tx = session.beginTransaction();
						
			StringBuffer strQuery = new StringBuffer(" SELECT UOF.CD_UNIDADE_ORGANIZ , "); 
			strQuery.append(" UOF.SG_UNIDADE_ORGANIZ 	 ");
			strQuery.append(" FROM crp_unidade_organi UOP ");
			strQuery.append(" INNER JOIN crp_unidade_organi UOF  ");				
			strQuery.append(" ON  UOP.CD_UNIDADE_ORGANIZ = UOF.CD_UNIDADE_SUPERIO WHERE ");
			strQuery.append(" UOP.CD_UNIDADE_ORGANIZ = :sigla OR ");
			strQuery.append(" UOP.CD_UNIDADE_ORGANIZ = :sigla  ");
			strQuery.append(" ORDER BY UOF.SG_UNIDADE_ORGANIZ ASC ");
			

			Query query = session.createSQLQuery(strQuery.toString());
			query.setString("sigla", "000000"+sigla);

			lista = (Collection<UnidadeOrganizacional>) query.list();
			tx.commit();

		} catch (RuntimeException e) {
			throw new AplicacaoException(e.getMessage(), e);
		}

		return lista;
	}
Criado 30 de outubro de 2009
Respostas 0
Participantes 1