Galera nao to conseguindo gerar tabelas com relacionamento OneToMany
Seguinte to fazendo uma locadora e No cadastro de Cliente que colocar um campos para os dependentes
mais ta dando erro e nao to conseguindo gerar me ajudem ai por favor!
Cliente.java
@Entity
public class Cliente implements java.io.Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
// @Column(name="id_cliente")
private Long id;
@Column(nullable=false, length=40,
insertable=true, updatable=true)
private String nome;
@Column(unique=true, nullable=false,
insertable=true, updatable=true)
private String cpf;
@Column(nullable=false)
/* Mapeamento para relacionamentos*/
@OneToOne//(cascade=CascadeType.PERSIST, fetch=FetchType.EAGER)
private Funcionario funcionario;
@OneToMany(mappedBy="dependente")
private List<Dependente> dependentes;
// Constructors
}
Dependente.java
@Entity
public class Dependente implements java.io.Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
private Cliente cliente;
}
Log
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.mytech.beans.Dependente.dependente in org.mytech.beans.Cliente.dependentes
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:543)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:508)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1127)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:756)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:93)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61)
at org.mytech.daos.GeraBanco.main(GeraBanco.java:12)
Outra coisa depois que eu coloquei o vraptor o meu log nao mostra mais nada sobre o hibernate so sobre o vraptor.!!!!