Guest User

Untitled

a guest
May 4th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
  5. http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
  6. version="1.1" bean-discovery-mode="all">
  7.  
  8. <scan>
  9. <exclude name="com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService"/>
  10. </scan>
  11.  
  12. <?xml version="1.0" encoding="UTF-8"?>
  13.  
  14. <validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
  15. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  16. xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration
  17. validation-configuration-1.1.xsd"
  18. version="1.1">
  19. <executable-validation enabled="false" />
  20.  
  21. <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  22. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  23. xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  24. http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
  25. version="2.0">
  26.  
  27.  
  28.  
  29. <!-- LOCAL (DEFAULT) -->
  30. <persistence-unit name="postgreSQL">
  31. <provider>org.hibernate.ejb.HibernatePersistence</provider>
  32.  
  33.  
  34. <properties>
  35. <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
  36.  
  37.  
  38. <!-- LOCAL -->
  39.  
  40. <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/rreefstore" />
  41. <property name="javax.persistence.jdbc.user" value="postgres" />
  42. <property name="javax.persistence.jdbc.password" value="dsv" />
  43.  
  44.  
  45. <!-- PRODUÇÃO -->
  46. <!-- <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://urlServer:5432/tfBestJob"
  47. /> <property name="javax.persistence.jdbc.user" value="adminbj" /> <property
  48. name="javax.persistence.jdbc.password" value="senha" /> -->
  49.  
  50.  
  51. <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
  52.  
  53. <property name="hibernate.show_sql" value="true" />
  54. <property name="hibernate.format_sql" value="true" />
  55. <property name="hibernate.hbm2ddl.auto" value="update" />
  56.  
  57. <property name="hibernate.c3p0.min_size" value="5" />
  58. <property name="hibernate.c3p0.max_size" value="10" />
  59. <property name="hibernate.c3p0.timeout" value="1800" />
  60. <property name="hibernate.c3p0.max_statements" value="50" />
  61.  
  62. </properties>
  63. </persistence-unit>
  64.  
  65. package br.com.rreefstore.model.entity;
  66.  
  67. import java.util.Calendar;
  68.  
  69. import javax.persistence.Column;
  70. import javax.persistence.Entity;
  71. import javax.persistence.GeneratedValue;
  72. import javax.persistence.GenerationType;
  73. import javax.persistence.Id;
  74. import javax.persistence.Table;
  75. import javax.persistence.UniqueConstraint;
  76.  
  77. /**
  78. * @author Tiago Ferezin
  79. *
  80. */
  81. @Entity
  82. @Table(uniqueConstraints = { @UniqueConstraint(columnNames = "codigoPedido", name = "uk_codigoPedido") })
  83. public class Pedido extends AEntity<Pedido> {
  84.  
  85. /**
  86. *
  87. */
  88. private static final long serialVersionUID = 1L;
  89.  
  90. @Id
  91. @GeneratedValue(strategy = GenerationType.IDENTITY)
  92. @Column(nullable = false)
  93. private Long idPedido;
  94.  
  95. @Column(nullable = false)
  96. private String codigoPedido;
  97.  
  98. @Column(nullable = false)
  99. private Integer quantidade;
  100.  
  101. @Column(nullable = false)
  102. private Calendar dataCriacao;
  103.  
  104. private Calendar dataDesativacao;
  105.  
  106. public Pedido() {
  107.  
  108. }
  109.  
  110. /**
  111. * @return the idPedido
  112. */
  113. public Long getIdPedido() {
  114. return idPedido;
  115. }
  116.  
  117. /**
  118. * @param idPedido the idPedido to set
  119. */
  120. public void setIdPedido(Long idPedido) {
  121. this.idPedido = idPedido;
  122. }
  123.  
  124. /**
  125. * @return the codigoPedido
  126. */
  127. public String getCodigoPedido() {
  128. return codigoPedido;
  129. }
  130.  
  131. /**
  132. * @param codigoPedido the codigoPedido to set
  133. */
  134. public void setCodigoPedido(String codigoPedido) {
  135. this.codigoPedido = codigoPedido;
  136. }
  137.  
  138. /**
  139. * @return the quantidade
  140. */
  141. public Integer getQuantidade() {
  142. return quantidade;
  143. }
  144.  
  145. /**
  146. * @param quantidade the quantidade to set
  147. */
  148. public void setQuantidade(Integer quantidade) {
  149. this.quantidade = quantidade;
  150. }
  151.  
  152. /**
  153. * @return the dataCriacao
  154. */
  155. public Calendar getDataCriacao() {
  156. return dataCriacao;
  157. }
  158.  
  159. /**
  160. * @param dataCriacao the dataCriacao to set
  161. */
  162. public void setDataCriacao(Calendar dataCriacao) {
  163. this.dataCriacao = dataCriacao;
  164. }
  165.  
  166. @Override
  167. public Long getId() {
  168. // TODO Auto-generated method stub
  169. return idPedido;
  170. }
  171.  
  172. @Override
  173. public void setId(Long id) {
  174. // TODO Auto-generated method stub
  175. this.idPedido = id;
  176. }
  177.  
  178. @Override
  179. public boolean isDeleted() {
  180. // TODO Auto-generated method stub
  181. return false;
  182. }
  183.  
  184. @Override
  185. public Calendar getDataDesativacao() {
  186. // TODO Auto-generated method stub
  187. return dataDesativacao;
  188. }
  189.  
  190. @Override
  191. public void setDataDesativacao(Calendar dataDesativacao) {
  192. // TODO Auto-generated method stub
  193. this.dataDesativacao = dataDesativacao;
  194. }
  195.  
  196. }
  197.  
  198. <property name="hbm2ddl.auto">validate</property>
  199.  
  200. validate: validar o schema, não faz mudanças no banco de dados.
  201. update: faz update o schema.
  202. create: cria o schema, destruindo dados anteriores.
  203. create-drop: drop o schema quando ao terminar a sessão.
Add Comment
Please, Sign In to add comment