Estou criando mapeamento “OneToMany” porém está me dando o erroa abaixo, algué pode dar uma força…
Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on br.com.junior.bean.Endereco.pessoa references an unknown entity: java.util.Collection
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:258)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at br.com.junior.bean.Geradatabase.main(Geradatabase.java:13)
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on br.com.junior.bean.Endereco.pessoa references an unknown entity: java.util.Collection
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:56)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:474)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:295)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1269)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:150)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:888)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:186)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:246)
[code]@Entity
public class Pessoa {
@Id
@Column(name = “pessoa_id”)
private long id;
private String name;
@OneToMany(mappedBy = "pessoa" , fetch = FetchType.LAZY)
private Collection<Endereco> endereco;
@Entity
public class Endereco {
@Id
private long id;
private String rua;
private String telefone;
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "pessoa")
@Fetch(FetchMode.JOIN)
private Collection<Pessoa> pessoa;[/code]