Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package br.com.app.entidades;
- import java.io.Serializable;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.GenerationType;
- import javax.persistence.Id;
- /**
- *
- * @author Wagner
- */
- @Entity
- public class Mesa implements Serializable {
- private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private Long id;
- private String descricao;
- public Mesa() {
- }
- public Long getId() {
- return id;
- }
- public void setId(Long id) {
- this.id = id;
- }
- public String getDescricao() {
- return descricao;
- }
- public void setDescricao(String descricao) {
- this.descricao = descricao;
- }
- @Override
- public int hashCode() {
- int hash = 0;
- hash += (id != null ? id.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 Mesa)) {
- return false;
- }
- Mesa other = (Mesa) object;
- if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
- return false;
- }
- return true;
- }
- @Override
- public String toString() {
- return "br.com.app.entidades.Mesa[ id=" + id + " ]";
- }
- }
- <?xml version="1.0" encoding="UTF-8"?>
- <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">
- <persistence-unit name="AppTestePU" transaction-type="RESOURCE_LOCAL">
- <provider>org.hibernate.ejb.HibernatePersistence</provider>
- <class>br.com.app.entidades.Mesa</class>
- <exclude-unlisted-classes>false</exclude-unlisted-classes>
- <properties>
- <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/teste2?zeroDateTimeBehavior=convertToNull"/>
- <property name="javax.persistence.jdbc.user" value="root"/>
- <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
- <property name="javax.persistence.jdbc.password" value="root"/>
- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
- <property name="javax.persistence.schema-generation.database.action" value="create"/>
- </properties>
- </persistence-unit>
- </persistence>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement