Advertisement
Guest User

Untitled

a guest
Nov 16th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  3.  
  4. <hibernate-configuration>
  5. <session-factory>
  6.  
  7. <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  8. <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  9. <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
  10. <property name="hibernate.connection.username">root</property>
  11. <property name="hibernate.connection.password">1234</property>
  12. <property name="hibernate.show_sql">true</property>
  13. <property name="hibernate.hbm2ddl.auto">create</property>
  14.  
  15. <mapping class="Inventory" package="com.mycompany.testhibernate"/>
  16.  
  17.  
  18. </session-factory>
  19. </hibernate-configuration>
  20.  
  21. package com.mycompany.testhibernate;
  22.  
  23. import java.io.Serializable;
  24. import javax.persistence.Entity;
  25. import javax.persistence.GeneratedValue;
  26. import javax.persistence.GenerationType;
  27. import javax.persistence.Id;
  28.  
  29. @Entity
  30. public class Inventory implements Serializable {
  31. private Integer id;
  32. private String itemName;
  33. private String itemNote;
  34. private Integer quantity;
  35.  
  36. @Id
  37. @GeneratedValue(strategy=GenerationType.AUTO)
  38. public int getId() {
  39. return id;
  40. }
  41.  
  42. public void setId(Integer id) {
  43. this.id = id;
  44. }
  45.  
  46. public String getItemName() {
  47. return this.itemName;
  48. }
  49.  
  50. public void setItemName(String itemName) {
  51. this.itemName = itemName;
  52. }
  53.  
  54. public String getItemNote() {
  55. return itemNote;
  56. }
  57.  
  58. public void setItemNote(String itemNote) {
  59. this.itemNote = itemNote;
  60. }
  61.  
  62. public void setQuantity(Integer quantity) {
  63. this.quantity = quantity;
  64. }
  65.  
  66. public int getQuantity() {
  67. return this.quantity;
  68. }
  69.  
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement