Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. public void registrar() {
  2.  
  3. alumno = new registrar_alumno_modelo(0, txtNombreA.getText());
  4. service.addAlumno(alumno);
  5.  
  6. }
  7.  
  8. @Entity(name="alumno")
  9.  
  10. @Id
  11. @GeneratedValue
  12. public int id;
  13.  
  14.  
  15. @Column(name="NombreA")
  16. private String nombre ;
  17.  
  18. @Column(name="Edad")
  19. private int edad;
  20.  
  21. @Column(name="FechaN")
  22. private Date fecha;
  23.  
  24. @Column(name="Sexo")
  25. private String sexo;
  26.  
  27. @Column(name="Nota")
  28. private String nota;
  29.  
  30. @Column(name="Generacion")
  31. private int generacion;
  32.  
  33. @Column(name="NickName")
  34. private String usuario;
  35.  
  36. @Column(name="Password")
  37. private String pass;
  38. */
  39. public registrar_alumno_modelo(int id, String nombre) {
  40. super();
  41. this.id = id;
  42. this.nombre = nombre;
  43.  
  44. }
  45.  
  46. public registrar_alumno_modelo() {
  47. this(0, "");
  48. }
  49.  
  50. public int getId() {
  51. return id;
  52. }
  53.  
  54. public void setId(int id) {
  55. this.id = id;
  56. }
  57.  
  58. public String getNombre() {
  59. return nombre;
  60. }
  61.  
  62. public void setNombre(String nombre) {
  63. this.nombre = nombre;
  64. }
  65.  
  66. /*public String getApellidos() {
  67. return apellidos;
  68. }
  69.  
  70. public void setApellidos(String apellidos) {
  71. this.apellidos = apellidos;
  72. }
  73.  
  74. public int getEdad() {
  75. return edad;
  76. }
  77.  
  78. public void setEdad(int edad) {
  79. this.edad = edad;
  80. }
  81.  
  82. public Date getFecha() {
  83. return fecha;
  84. }
  85.  
  86. public void setFecha(Date fecha) {
  87. this.fecha = fecha;
  88. }
  89.  
  90. public String getSexo() {
  91. return sexo;
  92. }
  93.  
  94. public void setSexo(String sexo) {
  95. this.sexo = sexo;
  96. }
  97.  
  98. public String getNota() {
  99. return nota;
  100. }
  101.  
  102. public void setNota(String nota) {
  103. this.nota = nota;
  104. }
  105.  
  106. public int getGeneracion() {
  107. return generacion;
  108. }
  109.  
  110. public void setGeneracion(int generacion) {
  111. this.generacion = generacion;
  112. }
  113.  
  114. public String getUsuario() {
  115. return usuario;
  116. }
  117.  
  118. public void setUsuario(String usuario) {
  119. this.usuario = usuario;
  120. }
  121.  
  122. public String getPass() {
  123. return pass;
  124. }
  125.  
  126. public void setPass(String pass) {
  127. this.pass = pass;
  128. }*/
  129.  
  130. @Override
  131. public String toString() {
  132. return "alumno [id=" + id + ", nombre=" + nombre + "]";
  133. }
  134.  
  135. private registro_alumno alumnoDao= new registro_alumno_Imp();
  136.  
  137.  
  138. @Override
  139. public void addAlumno(registrar_alumno_modelo alumno) {
  140. alumnoDao.addAlumno(alumno);
  141.  
  142. }
  143.  
  144. @Override
  145. public void addAlumno(registrar_alumno_modelo alumno) {
  146. Session session = HibernateUtil.openSession();
  147. session.beginTransaction();
  148. session.save(alumno);
  149. session.getTransaction().commit();
  150. session.close();
  151.  
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement