0
I know that fluent nhibernate
(Hibernate version for . net) uses lambdas
and that java
just implemented now in version 8.
But there is some form of configuration of hibernate
of java
through code? and not through xml
's?
0
I know that fluent nhibernate
(Hibernate version for . net) uses lambdas
and that java
just implemented now in version 8.
But there is some form of configuration of hibernate
of java
through code? and not through xml
's?
2
In the hibernate
mappings can already be done using annotations.
As in the example:
package model;
import javax.persistence.*;
@Entity
@Table(name="PESSOA")
public class Pessoa {
private int id;
private String rg;
private String nome;
private int idade;
private String estado;
private String cidade;
@Id
@GeneratedValue
@Column(name="PESSOA_ID")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name="PESSOA_RG", nullable=false)
public String getRg() {
return rg;
}
public void setRg(String rg) {
this.rg = rg;
}
@Column(name="PESSOA_NOME", nullable=false)
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@Column(name="PESSOA_IDADE")
public int getIdade() {
return idade;
}
public void setIdade(int idade) {
this.idade = idade;
}
@Column(name="PESSOA_ESTADO")
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
@Column(name="PESSOA_CIDADE")
public String getCidade() {
return cidade;
}
public void setCidade(String cidade) {
this.cidade = cidade;
}
}
Documentation of Hibernate.
Well it already helps me too, similar to Entity framework(via Annotations) thanks!
What I don’t really like this idea, is to associate the mapping to the business layer
The association exists, but it is weak. If there is any impediment you can use XML mapping as an option.
Browser other questions tagged java hibernate
You are not signed in. Login or sign up in order to post.
Sorry, I got it backwards...
– iuristona