Thanks for the advice. I've tried to map my objects as a many to many relationship with the following:
CategoryObject.java
Code:
@Entity
@Table(name="categories")
public class CategoryObject {
@Id
@Column(name="category_id")
@GeneratedValue
private int id;
private SiteObject site;
@Column(nullable = false)
private String name ;
public void setId(int id) {
this.id = id ;
}
public int getId() {
return id ;
}
public void setName(String name) {
this.name = name ;
}
public String getName() {
return name ;
}
public void setSite(SiteObject site) {
this.site = site ;
}
@ManyToMany
@JoinTable(name="sites", joinColumns={@JoinColumn(name="site_id")})
public SiteObject getSite() {
return site ;
}
}
SiteObject.java
Code:
@Entity
@Table(name="sites")
public class SiteObject {
@Id
@Column(name="site_id")
@GeneratedValue
private int id;
private CategoryObject category;
@Column(nullable = false)
private String name ;
@Column(nullable = false)
private String link ;
@Column(nullable = false)
private String logo ;
public void setId(int id) {
this.id = id ;
}
public int getId() {
return id ;
}
public void setName(String name) {
this.name = name ;
}
public String getName() {
return name ;
}
public void setLink(String link) {
this.link = link ;
}
public String getLink() {
return link ;
}
public void setLogo(String logo) {
this.logo = logo ;
}
public String getLogo() {
return logo ;
}
public void setCategory(CategoryObject category) {
this.category = category ;
}
@ManyToMany
@JoinTable(name="categories", joinColumns={@JoinColumn(name="category_id")})
public CategoryObject getCategory() {
return category ;
}
}
Which gives me the following error when I start my application server:
Code:
org.hibernate.MappingException: Could not determine type for:
SiteObject, for columns: [org.hibernate.mapping.Column(site)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:4
40)
I have commented out all my other hibernate mapping objects except these two. Any help would be greatly appreaciated.