Pessoal tenho uma tabela Categoria e preciso fazer um Autorelacionamento 1-n no hibernate e não estou conseguindo fazer… alguem poderia me ajudar ?
Uma CATEGORIA vão ter varias CATEGORIAS. Então preciso que a mesma tabela tenha uma relacionamento pra ela mesma.
Obs: Não posso usar hibernate Anotations. To usando hibernate core.
<many-to-one class="entidade.Categoria" column=""SUPERTIPO_SMFTB005"" fetch="join" insert="false" lazy="false" name="supertipo" update="false" />
Entidade
package entidade;
import java.io.Serializable;
public class Categoria implements Serializable {
private Integer id;
private String descricao;
private int supertipo;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public int getSupertipo() {
return supertipo;
}
public void setSupertipo(int supertipo) {
this.supertipo = supertipo;
}
}