Advertisement
Guest User

ManytoManyDepto

a guest
Jun 9th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package modelo;
  2. import java.io.Serializable;
  3. import java.util.List;
  4. import javax.persistence.*;
  5.  
  6.  
  7. @Entity
  8. @Table (name="depto")
  9. public class Depto implements Serializable {
  10.     @Id
  11.     @Column(name="id")  
  12.     @GeneratedValue(strategy = GenerationType.AUTO, generator = "depto_seq_gen")
  13.     @SequenceGenerator(name = "depto_seq_gen", sequenceName = "depto_id_seq")
  14.     private Long id;
  15.    
  16.     private String nome;
  17.  
  18.     @ManyToMany(mappedBy = "deptos")
  19.     private List<Funcionario> funcionarios;
  20.  
  21.     public List<Funcionario> getFuncionarios() {
  22.         return funcionarios;
  23.     }
  24.    
  25.     public Long getId() {
  26.         return id;
  27.     }
  28.  
  29.     public void setId(Long id) {
  30.         this.id = id;
  31.     }
  32.  
  33.     public String getNome() {
  34.         return nome;
  35.     }
  36.  
  37.     public void setNome(String nome) {
  38.         this.nome = nome;
  39.     }
  40.    
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement