[jboss-user] [EJB 3.0] - help composite keys

sashaxiv do-not-reply at jboss.com
Thu May 3 12:16:57 EDT 2007


what´s wrong with this?

@Entity
@Table(name="ruta")
public class Ruta{

.....

@OneToMany(mappedBy="ruta", cascade=CascadeType.REMOVE)
	public List getPuertos() {
		return rutapuertos;
	}

.....


------------------

@Entity
@Table(name="puerto")
public class Puerto {
...

	@OneToMany(mappedBy="puerto",cascade=CascadeType.REMOVE)
	public List getRutaPuertos() {
		return rutaPuertos;
	}
...
---------------------


@Entity
@Table(name="rutapuerto")
@IdClass(RutaPuertoPK.class)
public class RutaPuerto{
@Id
@Column(name="idPuerto",nullable=false,insertable=false,                updatable=false)
	public Long getIdPuerto() {
		return idPuerto;
	}

	//setter

	@Id
	@Column(name="idRuta",nullable=false,insertable=false,
            updatable=false)
	public Long getIdRuta() {
		return idRuta;
	}

	//setter

	@Column(name="kilometros")
	public Double getKilometros() {
		return kilometros;
	}

	public void setKilometros(Double kilometros) {
		this.kilometros = kilometros;
	}

	@ManyToOne(optional=false)
	@JoinColumn(name="idPuerto")
	public Puerto getPuerto() {
		return puerto;
	}

	public void setPuerto(Puerto puerto) {
		this.puerto = puerto;
	}

	@ManyToOne(optional=false)
	@JoinColumn(name="idRuta")
	public Ruta getRuta() {
		return ruta;
	}

	..............
	
	
}



Jboss tells me next error:

.......................
.......................
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: es.rutamanager.modelo.rutapuerto.entidad.RutaPuerto column: idPuerto (should be mapped with insert="false" update="false")


thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042891#4042891

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042891




More information about the jboss-user mailing list