Ajuda update no hibernate

1 resposta
fabioebner

pessoal rodei o seguinte update

String sql = "UPDATE db_notas.tb_parte set cd_parte_conjuge = null WHERE cd_parte_conjuge = "+codigoConjuge; Query query = ConexaoNotas.getInstance().getCurrentEM().createQuery(sql); int retorno = query.executeUpdate();

e recebi o seguinte erro:

<blockquote>java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: db_notas.tb_parte is not mapped [UPDATE db_notas.tb_parte set cd_parte_conjuge = null WHERE cd_parte_conjuge = 26]

at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:624)

at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)

at br.com.dnasolution.facade.ParteFACADE.removerConjuge(ParteFACADE.java:109)

at br.com.dnasolution.gui.GerenciarParteJDL.jbtSalvar(GerenciarParteJDL.java:1617)

</blockquote>

alguem sabe pq?? como arrumo isso??

valeu

1 Resposta

renanreismartins

createQuery() é quando se utiliza hql, tente: createNativeQuery() passando seu sql puro

abrassss

Criado 1 de junho de 2009
Ultima resposta 1 de jun. de 2009
Respostas 1
Participantes 2