Home » Eclipse Projects » EclipseLink » eclipselink does two inserts and one update when using cyclic references
eclipselink does two inserts and one update when using cyclic references [message #669831] |
Wed, 11 May 2011 14:04  |
Eclipse User |
|
|
|
hi all
i'm using cyclic references in a model like this:
@Entity
public class LancamentoNF extends BaseEntityObject implements Serializable {
@ManyToOne(cascade={CascadeType.PERSIST})
//@JoinColumn(name="lancamentos")
private MovFiscalContabil lancamentos = new MovFiscalContabil();
@Entity
@Table(name ="movfiscalcontabil")
public class MovFiscalContabil extends BaseEntityObject implements Serializable {
@ManyToOne
//@JoinColumn(name="id")
private LancamentoNF lancamentoNF;
but when i save the entity (LancamentoNF) the following occurs:
[EL Fine]: 2011-05-11 14:57:06.484--Connection(25881278)--INSERT INTO movfiscalcontabil (TIPOIMPOSTO, VALORICMS, VALORIPI, VALORDEBITO, VALORCREDITO, lancamentoscontabeis_id, empresas_id, planoContaDebito, LANCAMENTONF_ID, movimentoduplicatas_id, itensnf_id, planoContaIcms, planoContaIpi, planoContaCredito) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[EL Fine]: 2011-05-11 14:57:06.484--Connection(25881278)-- bind => [null, 10.0, 10.0, 1010.0, 990.0, null, null, null, null, null, null, null, null, null]
[EL Fine]: 2011-05-11 14:57:06.484--Connection(25881278)--select lastval()
[EL Fine]: 2011-05-11 14:57:06.484--Connection(25881278)--INSERT INTO LANCAMENTONF (CLIENTEFORNECEDORCOMPLEMENTO, BASECALCULO, CLIENTEFORNECEDORCEP, VALORIPI, CLIENTEFORNECEDORNUMERO, VALORTOTALNOTA, CLIENTEFORNECEDORINSCRICAOESTADUAL, CLIENTEFORNECEDORINSCRICAOMUNICIPAL, CLIENTEFORNECEDORLETRA, TIPODOCUMENTO, CLIENTEFORNECEDORMUNICIPIO, CLIENTEFORNECEDORNM, VALORPARCIALNOTA, CLIENTEFORNECEDORTIPOLOGRADOURO, CLIENTEFORNECEDORENDERECO, VALORICMS, NUMERO, SERIE, CLIENTEFORNECEDORFANTASIA, DATALANCAMENTO, DATAEMISSAO, CLIENTEFORNECEDORENDERECOCOMPLETO, CLIENTEFORNECEDORCPFCNPJ, ESPECIE, CLIENTEFORNECEDORUF, cfop_id, parametrosCFOP, tipologradouro_id, clientefornecedor_id, LANCAMENTOS_MOVFISCALCONTABIL_ID, modelonf_id, empresas_id, condicaopagamento_id, municipios_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[EL Fine]: 2011-05-11 14:57:06.484--Connection(25881278)-- bind => [Casa de esquina, 0.0, 85904130, 10.0, 1, 1010.0, , , a, 1, Exterior, Diogo Bla, 1000.0, Avenida, dasdsada, 10.0, 344, AB, Diogo, 2011-05-11, 2011-05-11, Avenida dasdsada, 1 - Centro - Exterior/Exterior, 051.092.549-90, NF, PR, 252, null, null, 3, 4, 40, 1, 1, null]
[EL Fine]: 2011-05-11 14:57:06.5--Connection(25881278)--select lastval()
[EL Fine]: 2011-05-11 14:57:06.5--Connection(25881278)--UPDATE movfiscalcontabil SET planoContaIcms = ?, VALORICMS = ?, VALORCREDITO = ?, VALORDEBITO = ?, planoContaCredito = ?, planoContaIpi = ?, LANCAMENTONF_ID = ?, VALORIPI = ?, empresas_id = ?, planoContaDebito = ? WHERE (MOVFISCALCONTABIL_ID = ?)
[EL Fine]: 2011-05-11 14:57:06.5--Connection(25881278)-- bind => [376, 10.0, 990.0, 1010.0, 120, 377, 6, 10.0, 1, 4, 4]
as the log says, he does a insert, then another insert, and then a update. but the problem is that for me, that update doesn't make any sense! I've debugged the app before saves the LancamentoNF entity, and the MovFiscalContabil is pretty fine!
i tried with and without the @joincolumn but had no success.
any ideas?
thanks a lot
[Updated on: Wed, 11 May 2011 14:11] by Moderator
|
|
| | | | |
Goto Forum:
Current Time: Wed Jul 23 13:22:16 EDT 2025
Powered by FUDForum. Page generated in 0.04551 seconds
|