Boa tarde
Eu tenho seguinte codigo:
@Entity
@Table(name = "USUARIO")
@NamedQueries({
@NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u")})
public class Usuario implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
@Basic(optional = false)
@Column(name = "IDUSER")
private Integer iduser;
@Basic(optional = false)
@Column(name = "NOME")
private String nome;
@Basic(optional = false)
@Column(name = "LOGIN")
private String login;
@OneToMany(mappedBy = "iduser")
private List<Referencias> referenciasList = new ArrayList<Referencias>();
@OneToMany(mappedBy = "iduser")
private List<CCorrente> cCorrenteList = new ArrayList<CCorrente>();
@OneToMany(mappedBy = "iduser")
private List<Relatorios> relatoriosList = new ArrayList<Relatorios>();
@OneToMany(mappedBy = "iduser")
private List<Veiculos> veiculosList = new ArrayList<Veiculos>();
//RELACIONAMENTOS BIDIRECIONAIS
@ManyToMany
@JoinTable(name="CC_USERS", joinColumns=@JoinColumn(name="IDUSER"),
inverseJoinColumns=@JoinColumn(name="IDCCUSTOS"))
private List<CentroCustos> ccList = new ArrayList<CentroCustos>();
@ManyToMany
@JoinTable(name="USER_CARGOS", joinColumns=@JoinColumn(name="IDUSER"),
inverseJoinColumns=@JoinColumn(name="IDCARGO"))
private List<Cargos> cargosList = new ArrayList<Cargos>();
public Usuario() {
}
public Usuario(Integer iduser) {
this.iduser = iduser;
}
public Usuario(Integer iduser, String nome, String login) {
this.iduser = iduser;
this.nome = nome;
this.login = login;
}
public Integer getIduser() {
return iduser;
}
public void setIduser(Integer iduser) {
this.iduser = iduser;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public List<Referencias> getReferenciasList() {
return referenciasList;
}
public void setReferenciasList(List<Referencias> referenciasList) {
this.referenciasList = referenciasList;
}
public List<CCorrente> getCCorrenteList() {
return cCorrenteList;
}
public void setCCorrenteList(List<CCorrente> cCorrenteList) {
this.cCorrenteList = cCorrenteList;
}
public List<Relatorios> getRelatoriosList() {
return relatoriosList;
}
public void setRelatoriosList(List<Relatorios> relatoriosList) {
this.relatoriosList = relatoriosList;
}
public List<Veiculos> getVeiculosList() {
return veiculosList;
}
public void setVeiculosList(List<Veiculos> veiculosList) {
this.veiculosList = veiculosList;
}
public List<CCorrente> getcCorrenteList() {
return cCorrenteList;
}
public void setcCorrenteList(List<CCorrente> cCorrenteList) {
this.cCorrenteList = cCorrenteList;
}
public List<Cargos> getCargosList() {
return cargosList;
}
public void setCargosList(List<Cargos> cargosList) {
this.cargosList = cargosList;
}
public List<CentroCustos> getCcList() {
return ccList;
}
public void setCcList(List<CentroCustos> ccList) {
this.ccList = ccList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (iduser != null ? iduser.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Usuario)) {
return false;
}
Usuario other = (Usuario) object;
if ((this.iduser == null && other.iduser != null) || (this.iduser != null && !this.iduser.equals(other.iduser))) {
return false;
}
return true;
}
@Override
public String toString() {
return "br.com.iddeia.entidades.Usuario[ iduser=" + iduser + " ]";
}
}
Como eu poderia fazer uma dao para cadastro desse usuário?