org.hibernate.MappingException: Could not determine type for
javierarg Apr 26, 2009 6:13 PMHi!
I´m trying a very simple relationship example but I get:
org.hibernate.MappingException: Could not determine type for: java.util.Collection, at table: Departamento, for columns: [org.hibernate.mapping.Column(empleados)]
The two classes:
[Departamento.java]
package test2.entity;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import org.hibernate.validator.Length;
@Entity
public class Departamento implements Serializable
{
// seam-gen attributes (you should probably edit these)
private Long id;
private Integer version;
private String name;
private Collection<Empleado> empleados;
// add additional entity attributes
// seam-gen attribute getters/setters with annotations (you probably should edit)
@Id @GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Version
public Integer getVersion() {
return version;
}
private void setVersion(Integer version) {
this.version = version;
}
@Length(max = 20)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(mappedBy="departamento")
public void setEmpleados(Collection<Empleado> empleados) {
this.empleados = empleados;
}
public Collection<Empleado> getEmpleados() {
return empleados;
}
}
[Empleado.java]
package test2.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.ManyToOne;
import javax.persistence.Version;
import org.hibernate.validator.Length;
@Entity
public class Empleado implements Serializable
{
// seam-gen attributes (you should probably edit these)
private Long id;
private Integer version;
private String name;
private Departamento departamento;
// add additional entity attributes
// seam-gen attribute getters/setters with annotations (you probably should edit)
@Id @GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Version
public Integer getVersion() {
return version;
}
private void setVersion(Integer version) {
this.version = version;
}
@Length(max = 20)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ManyToOne
public void setDepartamento(Departamento departamento) {
this.departamento = departamento;
}
public Departamento getDepartamento() {
return departamento;
}
}
Made by seam-gen using: jboss-seam-2.1.1.GA and jboss-5.0.1.GA.
What´s wrong in the code?
Thanks in advance
Javier
I´m trying a very simple relationship example but I get:
org.hibernate.MappingException: Could not determine type for: java.util.Collection, at table: Departamento, for columns: [org.hibernate.mapping.Column(empleados)]
The two classes:
[Departamento.java]
package test2.entity;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.OneToMany;
import javax.persistence.Version;
import org.hibernate.validator.Length;
@Entity
public class Departamento implements Serializable
{
// seam-gen attributes (you should probably edit these)
private Long id;
private Integer version;
private String name;
private Collection<Empleado> empleados;
// add additional entity attributes
// seam-gen attribute getters/setters with annotations (you probably should edit)
@Id @GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Version
public Integer getVersion() {
return version;
}
private void setVersion(Integer version) {
this.version = version;
}
@Length(max = 20)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@OneToMany(mappedBy="departamento")
public void setEmpleados(Collection<Empleado> empleados) {
this.empleados = empleados;
}
public Collection<Empleado> getEmpleados() {
return empleados;
}
}
[Empleado.java]
package test2.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.ManyToOne;
import javax.persistence.Version;
import org.hibernate.validator.Length;
@Entity
public class Empleado implements Serializable
{
// seam-gen attributes (you should probably edit these)
private Long id;
private Integer version;
private String name;
private Departamento departamento;
// add additional entity attributes
// seam-gen attribute getters/setters with annotations (you probably should edit)
@Id @GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Version
public Integer getVersion() {
return version;
}
private void setVersion(Integer version) {
this.version = version;
}
@Length(max = 20)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ManyToOne
public void setDepartamento(Departamento departamento) {
this.departamento = departamento;
}
public Departamento getDepartamento() {
return departamento;
}
}
Made by seam-gen using: jboss-seam-2.1.1.GA and jboss-5.0.1.GA.
What´s wrong in the code?
Thanks in advance
Javier