persistence@glassfish.java.net

Re: What is wrong in this relationship?

From: Wouter van Reeven <wouter_at_van.reeven.nl>
Date: Tue, 8 Dec 2009 15:40:45 +0100

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