Thanks a lot for your help.
Ok re the list of entities and each one with the Parametro, but how about
the first time when the Parametro has no ID yet?
Wouter van Reeven wrote:
>
> Please make sure that your Parametro has all the child TabelaIR entities
> added to its list and that every TabelaIR in that list has the correct
> Parametro set.
>
>
> Wouter
>
> On Tue, Dec 08, 2009 at 06:51:08AM -0800, Franzisk wrote:
>>
>> I removed that annotation but it keeps telling that the ID_PARAMETRO
>> which
>> goes to TABELA_IR is null:
>>
>> Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build
>> b09d-fcs
>> (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
>> Internal Exception: java.sql.SQLException: Duplicate key or integrity
>> constraint violation message from server: "Column 'ID_PARAMETRO' cannot
>> be
>> null"
>> Error Code: 1048
>> Call: INSERT INTO TABELA_IR_PARAMETROS (VALOR_BASE_FIM, ALIQUOTA,
>> VALOR_BASE_INICIO, VALOR_DEDUZIR, ID_PARAMETRO) VALUES (?, ?, ?, ?, ?)
>> bind => [5000.0, 11.0, 1000.0, 35.0, null]
>> Query: InsertObjectQuery([Tabela de IRRF])
>>
>>
>> Wouter van Reeven wrote:
>> >
>> > Hi,
>> >
>> >
>> > You don't need the @JoinColumn in the Parametro.java class.
>> >
>> >
>> > HTH, Wouter
>> >
>> > On Tue, Dec 08, 2009 at 06:33:18AM -0800, Franzisk wrote:
>> >>
>> >> I have these two Entities, Parametro and TabelaIR, Parametro can have
>> >> lots of
>> >> TabelaIR, so I have a 1xN.
>> >>
>> >> In Parametro.java I have:
>> >> @OneToMany(cascade = {CascadeType.ALL}, mappedBy = "parametro",
>> fetch
>> >> =
>> >> FetchType.LAZY, targetEntity = TabelaIR.class)
>> >> @JoinColumn(name = "ID_PARAMETRO")
>> >> public Collection<TabelaIR> getTabelasIR() {
>> >> return tabelasIR;
>> >> }
>> >>
>> >> In TabelaIR.java I have:
>> >> @ManyToOne(cascade = {CascadeType.ALL})
>> >> @JoinColumn(name = "ID_PARAMETRO", nullable = false)
>> >> public Parametro getParametro() {
>> >> return parametro;
>> >> }
>> >>
>> >> The problem is: when persisting the ID_PARAMETRO column in TABELA_IR
>> >> table
>> >> is not being saved, it should be set with the ID of of the PARAMETRO
>> >> table.
>> >>
>> >> What is wrong with my ralationship?
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/What-is-wrong-in-this-relationship--tp26694802p26694802.html
>> >> Sent from the java.net - glassfish persistence mailing list archive at
>> >> Nabble.com.
>> >
>> > --
>> > Gravity brings me down
>> > [Unknown Source]
>> >
>> > Skype: wvreeven
>> > Facebook: wvreeven
>> > Twitter: wvreeven
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/What-is-wrong-in-this-relationship--tp26694802p26695070.html
>> Sent from the java.net - glassfish persistence mailing list archive at
>> Nabble.com.
>
> --
> Veel shit is mest voor de toekomst.
> [Unknown Source]
>
> Skype: wvreeven
> Facebook: wvreeven
> Twitter: wvreeven
>
>
--
View this message in context: http://old.nabble.com/What-is-wrong-in-this-relationship--tp26694802p26695214.html
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.