I have a tutorial that goes into a fair bit of detail about how you set up various relationships using Hibernate annotations. You can find it here.
I'm going to assume that you'd want bi-directional relationships using a foreign key mapping (as shown in the tutorial, if this is wrong, you can find the uni-directional configurations there), you can basically just declare your classes like this:
@Entity
@Table
public class Matricula {
@Id
private long matriculaId;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "alunoId")
private Aluno aluno;
@OneToMany(mappedBy="turma")
private List<Turma> turmas;
@OneToMany(mappedBy="modalidade")
private List<Modalidade> modalidades;
}
@Entity
@Table
public class Turma {
//Put a unique ID here to be used as PK
@ManyToOne
@JoinColumn(name="matriculaId)
private Matricula matricula;
}
@Entity
@Table
public class Modalidade {
//Put a unique ID here to be used as PK
@ManyToOne
@JoinColumn(name="matriculaId)
private Matricula matricula;
}
@Entity
@Table
public class Aluno {
//Put a unique ID here to be used as PK
@OneToOne(mappedBy="aluno")
private Matricula matricula;
}
Please note that this is assuming that your column names will match, and that your database is correctly set up.
Hope it goes well