Olá Pessoal,
Estou tendo um problema ao gerar minhas entidades no hibernate, acontece que ele está gerando em duplicidade… se alguém puder me ajudar…
[code]@Entity
@Table(name = “TB_Lj”)
public class Loja {
private int id;
private String nome;
private String descricao;
private LojaSegmento lojaSegmento;
private LojaStatus lojaStatus;
public Loja() {
// TODO Auto-generated constructor stub
}
public Loja(String nome, String descricao, LojaSegmento lojaSegmento,
LojaStatus lojaStatus) {
super();
this.nome = nome;
this.descricao = descricao;
// this.lojaSegmento = lojaSegmento;
// this.lojaStatus = lojaStatus;
}
@Id
@GeneratedValue
@Column(name = "Id")
public int getId() {
return id;
}
@Column(name = "Nome")
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@Column(name = "Descricao")
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
@ManyToOne
public LojaSegmento getLojaSegmento() {
return lojaSegmento;
}
public void setLojaSegmento(LojaSegmento lojaSegmento) {
this.lojaSegmento = lojaSegmento;
}
@ManyToOne
public LojaStatus getLojaStatus() {
return lojaStatus;
}
public void setLojaStatus(LojaStatus lojaStatus) {
this.lojaStatus = lojaStatus;
}
}[/code]
[code]@Entity
@Table(name = “TB_Lj_Status”)
public class LojaStatus {
private int id;
private String nome;
private List<Loja> lojas = new ArrayList<Loja>();
public LojaStatus() {
// TODO Auto-generated constructor stub
}
@Id
@GeneratedValue
@Column(name = "Id")
public int getId() {
return id;
}
@Column(name = "Nome")
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@OneToMany(targetEntity = Loja.class)
public List<Loja> getLoja() {
return lojas;
}
public void setLoja(List<Loja> loja) {
this.lojas = loja;
}
}[/code]
[code] true
true
<property name="hibernate.hbm2ddl.auto">updade</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.timeout">180</property>
<property name="hibernate.c3p0.max_statements">10</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.use_sql_comments">true</property>
<mapping class="br.com.loja.entidades.Loja"/>
<mapping class="br.com.loja.entidades.LojaSegmento"/>
<mapping class="br.com.loja.entidades.LojaStatus"/>
[/code]