Hello Icky
You should be fine doing it like this:
I'm using a Project-Risk-Exampe; a project has many risks. I'm also
using MySQL and appfuse respectively hibernate wants me to define a
default value. That's why I've been using the columnDefinition-Attribute
within the JoinColumn-Annotation.
Risk:
Attributes:
private Project project;
private Long projectId;
Methods:
@ManyToOne(optional = false)
@JoinColumn(name = "project_id", nullable = false, updatable = true,
columnDefinition = "int default 0")
public Project getProject() {
return project;
}
public void setProject(Project project) {
this.project = project;
}
@Column(name = "project_id", nullable=false, insertable=false,
updatable=true)
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
Project:
Attributes:
private Set<Risk> risks = new HashSet<Risk>();
Methods:
@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER,
mappedBy = "project")
public Set<Risk> getRisks() {
return risks;
}
public void setRisks(Set<Risk> risks) {
this.risks = risks;
}
I hope this works for you.
/Mike
icky schrieb:
hi everybody!
I'm new to appfuse, so please help me out here to find a tutorial,
with an explanation of two objects related with a one-to-many
relationship (for instance, Employee + Department) and how this can be
mapped, etc. in appfuse using Spring MVC + Hibernate.
Thanks in advance! Any answer is appreciated!
the best,
Ikrom
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]