insertar con createNativeQuery (Hibernate)
Hola como estan, tengo la siguiente línea de código:
public void insertNativeQuery(EntityManager em, String consulta) throws Exception {
if( em == null )
throw new BOException("msg0003" );
// if( obj == null)
// throw new BOException("msg0235" );
try{
em.createNativeQuery(consulta);
em.flush();
}catch(Exception ex){
throw new GenericException("msg0240", ex.getMessage() );
}
}
Es una NativeQuery en el cual pienso insertar registros, pero al realizar esto, no se ven los resultados en la bd, si lo hago notmalmente con createQuery y con entidades, lo hace correctamente, pero con el codigo nativo de sql no, agradezco de antemano cualquier ayuda.
- Inicie sesión o regístrese para enviar comentarios
solucionado
faltaba colocar un em.createNativeQuery(consulta).executeUpdate();