Hello,
I have one problem here. I wonder if some one could help me?
so, I need to update my entire table using JPA, I want to pass all data of one column to other column.
I im trying this:
em.createQuery("UPDATE Cole AS c SET c.coleAnt = c.coleAtu, c.forneAnt = c.forneAtu").executeUpdate();
but in some moment I got a exception like this:
*Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DatabaseException*
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO TL_coleta (idColeta, coleta_ant, fornecedor_ant) SELECT t0.idColeta, t0.coleta_atu, t1.idfornecedor FROM coleta t0, coleta t2, fornecedor t1 WHERE (t1.idfornecedor = t2.fornecedor_atu)
Query: UpdateAllQuery()
how Can I soulve this ???
thanks