Здравствуйте.
Есть два таблицы, пытаюсь связать их отношением один ко многим ─Category @OneToMany Content
@Entity
@Table(name = "categorys")
public class Category {
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "is_active", columnDefinition = "boolean default true")
private boolean isActive;
@Column(name = "title")
private String title;
@Column(name = "subtitle")
private String subtitle;
private List<Content> contents;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSubtitle() {
return subtitle;
}
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "category")
public List<Content> getContents() {
return contents;
}
public void setContents(List<Content> contents) {
this.contents = contents;
}
}
@Entity
@Table(name = "contents")
public class Content {
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "content")
private String content;
private Category category;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@ManyToOne( fetch = FetchType.LAZY)
@JoinColumn(name = "category_id", nullable = false)
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
}
При создании таблиц получаю
org.hibernate.MappingException: Could not determine type for: net.codejava.spring.model.Category, at table: contents, for columns: [org.hibernate.mapping.Column(category)]
Как я понимаю hibernate не может понять каким типом делать столбец category