I've seen this exception in other topics on the forum, but what I'm doing is a good deal simpler. I have two classes in a many-to-one relationship: A Host has collection of HostVals, each of which has a hostId property containing the primary key for the Host. Pretty simple.
The first line of the exception is:
org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Column(hostVals)]
Is it saying it can't figure that it's a List of HostVal objects?
Here are the two classes:
Code:
@Entity
public class Host implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="hostId", length=40)
private String hostId;
private List<HostVal> hostVals;
public Host() {
super();
}
public String getHostId() {
return this.hostId;
}
public void setHostId(String hostId) {
this.hostId = hostId;
}
@OneToMany(mappedBy="hostId")
public List<HostVal> getHostVals() {
return hostVals;
}
public void setHostVals(List<HostVal> hostVals) {
this.hostVals = hostVals;
}
}
Code:
@Entity
public class HostVal implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private long hostValId;
@Column(name="hostId", length=40)
private String hostId;
@Column(length=30)
private String keyName;
@Column(length=80)
private String keyValue;
private Host host;
public HostVal() {
super();
}
public long getHostValId() {
return hostValId;
}
public void setHostValId(long hostValId) {
this.hostValId = hostValId;
}
@ManyToOne(optional = true)
public String getHostId() {
return hostId;
}
public void setHostId(String hostId) {
this.hostId = hostId;
}
public String getKeyName() {
return keyName;
}
public void setKeyName(String keyName) {
this.keyName = keyName;
}
public String getKeyValue() {
return keyValue;
}
public void setKeyValue(String keyValue) {
this.keyValue = keyValue;
}
public Host getHost() {
return host;
}
public void setHost(Host host) {
this.host = host;
}
}