Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package br.com.app.entidades;
  7.  
  8. import java.io.Serializable;
  9. import javax.persistence.Entity;
  10. import javax.persistence.GeneratedValue;
  11. import javax.persistence.GenerationType;
  12. import javax.persistence.Id;
  13.  
  14. /**
  15. *
  16. * @author Wagner
  17. */
  18. @Entity
  19. public class Mesa implements Serializable {
  20.  
  21. private static final long serialVersionUID = 1L;
  22. @Id
  23. @GeneratedValue(strategy = GenerationType.AUTO)
  24. private Long id;
  25. private String descricao;
  26.  
  27. public Mesa() {
  28. }
  29.  
  30.  
  31.  
  32. public Long getId() {
  33. return id;
  34. }
  35.  
  36. public void setId(Long id) {
  37. this.id = id;
  38. }
  39.  
  40. public String getDescricao() {
  41. return descricao;
  42. }
  43.  
  44. public void setDescricao(String descricao) {
  45. this.descricao = descricao;
  46. }
  47.  
  48.  
  49.  
  50. @Override
  51. public int hashCode() {
  52. int hash = 0;
  53. hash += (id != null ? id.hashCode() : 0);
  54. return hash;
  55. }
  56.  
  57. @Override
  58. public boolean equals(Object object) {
  59. // TODO: Warning - this method won't work in the case the id fields are not set
  60. if (!(object instanceof Mesa)) {
  61. return false;
  62. }
  63. Mesa other = (Mesa) object;
  64. if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
  65. return false;
  66. }
  67. return true;
  68. }
  69.  
  70. @Override
  71. public String toString() {
  72. return "br.com.app.entidades.Mesa[ id=" + id + " ]";
  73. }
  74.  
  75. }
  76.  
  77. <?xml version="1.0" encoding="UTF-8"?>
  78. <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  79. <persistence-unit name="AppTestePU" transaction-type="RESOURCE_LOCAL">
  80. <provider>org.hibernate.ejb.HibernatePersistence</provider>
  81. <class>br.com.app.entidades.Mesa</class>
  82. <exclude-unlisted-classes>false</exclude-unlisted-classes>
  83. <properties>
  84. <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/teste2?zeroDateTimeBehavior=convertToNull"/>
  85. <property name="javax.persistence.jdbc.user" value="root"/>
  86. <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
  87. <property name="javax.persistence.jdbc.password" value="root"/>
  88. <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
  89. <property name="javax.persistence.schema-generation.database.action" value="create"/>
  90. </properties>
  91. </persistence-unit>
  92. </persistence>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement