diff --git a/HibernateTest/.idea/artifacts/HibernateDamo_war_exploded.xml b/HibernateTest/.idea/artifacts/HibernateDamo_war_exploded.xml
new file mode 100644
index 0000000..73e91a1
--- /dev/null
+++ b/HibernateTest/.idea/artifacts/HibernateDamo_war_exploded.xml
@@ -0,0 +1,13 @@
+
+
+ $PROJECT_DIR$/out/artifacts/HibernateDamo_war_exploded
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/compiler.xml b/HibernateTest/.idea/compiler.xml
new file mode 100644
index 0000000..38d573b
--- /dev/null
+++ b/HibernateTest/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/dataSources.local.xml b/HibernateTest/.idea/dataSources.local.xml
new file mode 100644
index 0000000..bd41cf1
--- /dev/null
+++ b/HibernateTest/.idea/dataSources.local.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+ #@
+ `
+
+
+ master_key
+ root
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/dataSources.xml b/HibernateTest/.idea/dataSources.xml
new file mode 100644
index 0000000..4f378be
--- /dev/null
+++ b/HibernateTest/.idea/dataSources.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://localhost:3306/xianshu
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e.xml b/HibernateTest/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e.xml
new file mode 100644
index 0000000..1c6e8a2
--- /dev/null
+++ b/HibernateTest/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e.xml
@@ -0,0 +1,1261 @@
+
+
+
+
+ 8.0.16
+ InnoDB
+ InnoDB
+ lower/lower
+
+
+ utf8mb4_0900_ai_ci
+
+
+ utf8_general_ci
+
+
+ utf8mb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 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+ utf8mb4
+ 0
+
+
+
+
+
+
+ 1
+ int(10) unsigned|0s
+ 1
+ 1
+ normal
+
+
+ 2
+ varchar(45)|0s
+ normal
+
+
+ 3
+ int(11)|0s
+ normal
+
+
+ 4
+ varchar(45)|0s
+ normal
+
+
+ 5
+ varchar(45)|0s
+ normal
+
+
+ 6
+ int(11)|0s
+ normal
+
+
+ bookid
+ 1
+ btree
+
+
+ 1
+ bookid
+ 1
+
+
+ bookid
+ bookid_UNIQUE
+
+
+ 1
+ int(11)|0s
+ 1
+ 1
+ normal
+
+
+ 2
+ int(11)|0s
+ normal
+
+
+ 3
+ int(11)|0s
+ normal
+
+
+ 4
+ int(11)|0s
+ normal
+
+
+ orderId
+ 1
+ btree
+
+
+ 1
+ orderId
+ 1
+
+
+ orderId
+ orderId_UNIQUE
+
+
+ 1
+ int(11)|0s
+ 1
+ normal
+
+
+ 2
+ int(11)|0s
+ normal
+
+
+ 3
+ int(11)|0s
+ normal
+
+
+ 1
+ cartID
+ 1
+
+
+ 1
+ int(11)|0s
+ 1
+ normal
+
+
+ 2
+ varchar(45)|0s
+ normal
+
+
+ 3
+ varchar(45)|0s
+ normal
+
+
+ 4
+ varchar(45)|0s
+ normal
+
+
+ 5
+ varchar(45)|0s
+ normal
+
+
+ 1
+ userID
+ 1
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e/storage_v2/_src_/schema/information_schema.FNRwLQ.meta b/HibernateTest/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e/storage_v2/_src_/schema/information_schema.FNRwLQ.meta
new file mode 100644
index 0000000..1ff3db2
--- /dev/null
+++ b/HibernateTest/.idea/dataSources/f04c8927-a966-444e-85ca-60ef5b013a3e/storage_v2/_src_/schema/information_schema.FNRwLQ.meta
@@ -0,0 +1,2 @@
+#n:information_schema
+! [null, 0, null, null, -2147483648, -2147483648]
diff --git a/HibernateTest/.idea/libraries/Hibernate_5_4_9_5_4_9.xml b/HibernateTest/.idea/libraries/Hibernate_5_4_9_5_4_9.xml
new file mode 100644
index 0000000..30f2e26
--- /dev/null
+++ b/HibernateTest/.idea/libraries/Hibernate_5_4_9_5_4_9.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/libraries/lib.xml b/HibernateTest/.idea/libraries/lib.xml
new file mode 100644
index 0000000..fa8838a
--- /dev/null
+++ b/HibernateTest/.idea/libraries/lib.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/libraries/lib__2_.xml b/HibernateTest/.idea/libraries/lib__2_.xml
new file mode 100644
index 0000000..0ae6450
--- /dev/null
+++ b/HibernateTest/.idea/libraries/lib__2_.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/misc.xml b/HibernateTest/.idea/misc.xml
new file mode 100644
index 0000000..0548357
--- /dev/null
+++ b/HibernateTest/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/modules.xml b/HibernateTest/.idea/modules.xml
new file mode 100644
index 0000000..d1c5c0b
--- /dev/null
+++ b/HibernateTest/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/uiDesigner.xml b/HibernateTest/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/HibernateTest/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/.idea/workspace.xml b/HibernateTest/.idea/workspace.xml
new file mode 100644
index 0000000..dcaa152
--- /dev/null
+++ b/HibernateTest/.idea/workspace.xml
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1577946059823
+
+
+ 1577946059823
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/HibernateDamo.iml b/HibernateTest/HibernateDamo.iml
new file mode 100644
index 0000000..6a1ffad
--- /dev/null
+++ b/HibernateTest/HibernateDamo.iml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/lib/FastInfoset-1.2.15.jar b/HibernateTest/lib/FastInfoset-1.2.15.jar
new file mode 100644
index 0000000..2671209
Binary files /dev/null and b/HibernateTest/lib/FastInfoset-1.2.15.jar differ
diff --git a/HibernateTest/lib/antlr-2.7.7.jar b/HibernateTest/lib/antlr-2.7.7.jar
new file mode 100644
index 0000000..5e5f14b
Binary files /dev/null and b/HibernateTest/lib/antlr-2.7.7.jar differ
diff --git a/HibernateTest/lib/byte-buddy-1.10.2.jar b/HibernateTest/lib/byte-buddy-1.10.2.jar
new file mode 100644
index 0000000..b04187b
Binary files /dev/null and b/HibernateTest/lib/byte-buddy-1.10.2.jar differ
diff --git a/HibernateTest/lib/classmate-1.5.1.jar b/HibernateTest/lib/classmate-1.5.1.jar
new file mode 100644
index 0000000..819f5ea
Binary files /dev/null and b/HibernateTest/lib/classmate-1.5.1.jar differ
diff --git a/HibernateTest/lib/dom4j-2.1.1.jar b/HibernateTest/lib/dom4j-2.1.1.jar
new file mode 100644
index 0000000..cda47db
Binary files /dev/null and b/HibernateTest/lib/dom4j-2.1.1.jar differ
diff --git a/HibernateTest/lib/hibernate-commons-annotations-5.1.0.Final.jar b/HibernateTest/lib/hibernate-commons-annotations-5.1.0.Final.jar
new file mode 100644
index 0000000..9a9d5b7
Binary files /dev/null and b/HibernateTest/lib/hibernate-commons-annotations-5.1.0.Final.jar differ
diff --git a/HibernateTest/lib/hibernate-core-5.4.9.Final.jar b/HibernateTest/lib/hibernate-core-5.4.9.Final.jar
new file mode 100644
index 0000000..91a2062
Binary files /dev/null and b/HibernateTest/lib/hibernate-core-5.4.9.Final.jar differ
diff --git a/HibernateTest/lib/istack-commons-runtime-3.0.7.jar b/HibernateTest/lib/istack-commons-runtime-3.0.7.jar
new file mode 100644
index 0000000..2fe5b82
Binary files /dev/null and b/HibernateTest/lib/istack-commons-runtime-3.0.7.jar differ
diff --git a/HibernateTest/lib/jandex-2.1.1.Final.jar b/HibernateTest/lib/jandex-2.1.1.Final.jar
new file mode 100644
index 0000000..4162ece
Binary files /dev/null and b/HibernateTest/lib/jandex-2.1.1.Final.jar differ
diff --git a/HibernateTest/lib/javassist-3.24.0-GA.jar b/HibernateTest/lib/javassist-3.24.0-GA.jar
new file mode 100644
index 0000000..977a081
Binary files /dev/null and b/HibernateTest/lib/javassist-3.24.0-GA.jar differ
diff --git a/HibernateTest/lib/javax.activation-api-1.2.0.jar b/HibernateTest/lib/javax.activation-api-1.2.0.jar
new file mode 100644
index 0000000..986c365
Binary files /dev/null and b/HibernateTest/lib/javax.activation-api-1.2.0.jar differ
diff --git a/HibernateTest/lib/javax.persistence-api-2.2.jar b/HibernateTest/lib/javax.persistence-api-2.2.jar
new file mode 100644
index 0000000..164ef3a
Binary files /dev/null and b/HibernateTest/lib/javax.persistence-api-2.2.jar differ
diff --git a/HibernateTest/lib/jaxb-api-2.3.1.jar b/HibernateTest/lib/jaxb-api-2.3.1.jar
new file mode 100644
index 0000000..4565865
Binary files /dev/null and b/HibernateTest/lib/jaxb-api-2.3.1.jar differ
diff --git a/HibernateTest/lib/jaxb-runtime-2.3.1.jar b/HibernateTest/lib/jaxb-runtime-2.3.1.jar
new file mode 100644
index 0000000..0b9ef67
Binary files /dev/null and b/HibernateTest/lib/jaxb-runtime-2.3.1.jar differ
diff --git a/HibernateTest/lib/jboss-logging-3.3.2.Final.jar b/HibernateTest/lib/jboss-logging-3.3.2.Final.jar
new file mode 100644
index 0000000..67cde71
Binary files /dev/null and b/HibernateTest/lib/jboss-logging-3.3.2.Final.jar differ
diff --git a/HibernateTest/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar b/HibernateTest/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar
new file mode 100644
index 0000000..627f7ce
Binary files /dev/null and b/HibernateTest/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar differ
diff --git a/HibernateTest/lib/mysql-connector-java-5.1.40-bin.jar b/HibernateTest/lib/mysql-connector-java-5.1.40-bin.jar
new file mode 100644
index 0000000..60bef5c
Binary files /dev/null and b/HibernateTest/lib/mysql-connector-java-5.1.40-bin.jar differ
diff --git a/HibernateTest/lib/mysql-connector-java-5.1.47.jar b/HibernateTest/lib/mysql-connector-java-5.1.47.jar
new file mode 100644
index 0000000..f3398ed
Binary files /dev/null and b/HibernateTest/lib/mysql-connector-java-5.1.47.jar differ
diff --git a/HibernateTest/lib/stax-ex-1.8.jar b/HibernateTest/lib/stax-ex-1.8.jar
new file mode 100644
index 0000000..5e60637
Binary files /dev/null and b/HibernateTest/lib/stax-ex-1.8.jar differ
diff --git a/HibernateTest/lib/txw2-2.3.1.jar b/HibernateTest/lib/txw2-2.3.1.jar
new file mode 100644
index 0000000..75ed519
Binary files /dev/null and b/HibernateTest/lib/txw2-2.3.1.jar differ
diff --git a/HibernateTest/out/production/HibernateDamo/META-INF/HibernateDamo.kotlin_module b/HibernateTest/out/production/HibernateDamo/META-INF/HibernateDamo.kotlin_module
new file mode 100644
index 0000000..2983af7
Binary files /dev/null and b/HibernateTest/out/production/HibernateDamo/META-INF/HibernateDamo.kotlin_module differ
diff --git a/HibernateTest/out/production/HibernateDamo/Main.class b/HibernateTest/out/production/HibernateDamo/Main.class
new file mode 100644
index 0000000..d55e655
Binary files /dev/null and b/HibernateTest/out/production/HibernateDamo/Main.class differ
diff --git a/HibernateTest/out/production/HibernateDamo/hibernate.cfg.xml b/HibernateTest/out/production/HibernateDamo/hibernate.cfg.xml
new file mode 100644
index 0000000..3df5d08
--- /dev/null
+++ b/HibernateTest/out/production/HibernateDamo/hibernate.cfg.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ jdbc:mysql://localhost:3306/xianshu
+ com.mysql.jdbc.Driver
+
+ root
+ 123456
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/out/production/HibernateDamo/table/BookEntity.class b/HibernateTest/out/production/HibernateDamo/table/BookEntity.class
new file mode 100644
index 0000000..63f8ec6
Binary files /dev/null and b/HibernateTest/out/production/HibernateDamo/table/BookEntity.class differ
diff --git a/HibernateTest/out/production/HibernateDamo/table/BookEntity.hbm.xml b/HibernateTest/out/production/HibernateDamo/table/BookEntity.hbm.xml
new file mode 100644
index 0000000..dd709b9
--- /dev/null
+++ b/HibernateTest/out/production/HibernateDamo/table/BookEntity.hbm.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/out/production/HibernateDamo/table/OrderEntity.class b/HibernateTest/out/production/HibernateDamo/table/OrderEntity.class
new file mode 100644
index 0000000..8700ff8
Binary files /dev/null and b/HibernateTest/out/production/HibernateDamo/table/OrderEntity.class differ
diff --git a/HibernateTest/out/production/HibernateDamo/table/OrderEntity.hbm.xml b/HibernateTest/out/production/HibernateDamo/table/OrderEntity.hbm.xml
new file mode 100644
index 0000000..33b7094
--- /dev/null
+++ b/HibernateTest/out/production/HibernateDamo/table/OrderEntity.hbm.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/out/production/HibernateDamo/table/ShopcartEntity.class b/HibernateTest/out/production/HibernateDamo/table/ShopcartEntity.class
new file mode 100644
index 0000000..5cb77b8
Binary files /dev/null and b/HibernateTest/out/production/HibernateDamo/table/ShopcartEntity.class differ
diff --git a/HibernateTest/out/production/HibernateDamo/table/ShopcartEntity.hbm.xml b/HibernateTest/out/production/HibernateDamo/table/ShopcartEntity.hbm.xml
new file mode 100644
index 0000000..603813b
--- /dev/null
+++ b/HibernateTest/out/production/HibernateDamo/table/ShopcartEntity.hbm.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/out/production/HibernateDamo/table/UserEntity.class b/HibernateTest/out/production/HibernateDamo/table/UserEntity.class
new file mode 100644
index 0000000..d93e263
Binary files /dev/null and b/HibernateTest/out/production/HibernateDamo/table/UserEntity.class differ
diff --git a/HibernateTest/out/production/HibernateDamo/table/UserEntity.hbm.xml b/HibernateTest/out/production/HibernateDamo/table/UserEntity.hbm.xml
new file mode 100644
index 0000000..a07dd51
--- /dev/null
+++ b/HibernateTest/out/production/HibernateDamo/table/UserEntity.hbm.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/out/production/HibernateDamo/test/StudentsTest.class b/HibernateTest/out/production/HibernateDamo/test/StudentsTest.class
new file mode 100644
index 0000000..6415ada
Binary files /dev/null and b/HibernateTest/out/production/HibernateDamo/test/StudentsTest.class differ
diff --git a/HibernateTest/src/Main.java b/HibernateTest/src/Main.java
new file mode 100644
index 0000000..61bfb95
--- /dev/null
+++ b/HibernateTest/src/Main.java
@@ -0,0 +1,47 @@
+import org.hibernate.HibernateException;
+import org.hibernate.Metamodel;
+import org.hibernate.query.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+import javax.persistence.metamodel.EntityType;
+
+import java.util.Map;
+
+public class Main {
+ private static final SessionFactory ourSessionFactory;
+
+ static {
+ try {
+ Configuration configuration = new Configuration();
+ configuration.configure();
+
+ ourSessionFactory = configuration.buildSessionFactory();
+ } catch (Throwable ex) {
+ throw new ExceptionInInitializerError(ex);
+ }
+ }
+
+ public static Session getSession() throws HibernateException {
+ return ourSessionFactory.openSession();
+ }
+
+ public static void main(final String[] args) throws Exception {
+ final Session session = getSession();
+ try {
+ System.out.println("querying all the managed entities...");
+ final Metamodel metamodel = session.getSessionFactory().getMetamodel();
+ for (EntityType> entityType : metamodel.getEntities()) {
+ final String entityName = entityType.getName();
+ final Query query = session.createQuery("from " + entityName);
+ System.out.println("executing: " + query.getQueryString());
+ for (Object o : query.list()) {
+ System.out.println(" " + o);
+ }
+ }
+ } finally {
+ session.close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/HibernateTest/src/hibernate.cfg.xml b/HibernateTest/src/hibernate.cfg.xml
new file mode 100644
index 0000000..3df5d08
--- /dev/null
+++ b/HibernateTest/src/hibernate.cfg.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ jdbc:mysql://localhost:3306/xianshu
+ com.mysql.jdbc.Driver
+
+ root
+ 123456
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/src/table/BookEntity.hbm.xml b/HibernateTest/src/table/BookEntity.hbm.xml
new file mode 100644
index 0000000..dd709b9
--- /dev/null
+++ b/HibernateTest/src/table/BookEntity.hbm.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/src/table/BookEntity.java b/HibernateTest/src/table/BookEntity.java
new file mode 100644
index 0000000..ccceaf6
--- /dev/null
+++ b/HibernateTest/src/table/BookEntity.java
@@ -0,0 +1,93 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "book", schema = "xianshu", catalog = "")
+public class BookEntity {
+ private int bookid;
+ private String bookname;
+ private Integer price;
+ private String category;
+ private String imageurl;
+ private Integer sellerId;
+
+ @Id
+ @Column(name = "bookid")
+ public int getBookid() {
+ return bookid;
+ }
+
+ public void setBookid(int bookid) {
+ this.bookid = bookid;
+ }
+
+ @Basic
+ @Column(name = "bookname")
+ public String getBookname() {
+ return bookname;
+ }
+
+ public void setBookname(String bookname) {
+ this.bookname = bookname;
+ }
+
+ @Basic
+ @Column(name = "price")
+ public Integer getPrice() {
+ return price;
+ }
+
+ public void setPrice(Integer price) {
+ this.price = price;
+ }
+
+ @Basic
+ @Column(name = "category")
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ @Basic
+ @Column(name = "imageurl")
+ public String getImageurl() {
+ return imageurl;
+ }
+
+ public void setImageurl(String imageurl) {
+ this.imageurl = imageurl;
+ }
+
+ @Basic
+ @Column(name = "sellerID")
+ public Integer getSellerId() {
+ return sellerId;
+ }
+
+ public void setSellerId(Integer sellerId) {
+ this.sellerId = sellerId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ BookEntity that = (BookEntity) o;
+ return bookid == that.bookid &&
+ Objects.equals(bookname, that.bookname) &&
+ Objects.equals(price, that.price) &&
+ Objects.equals(category, that.category) &&
+ Objects.equals(imageurl, that.imageurl) &&
+ Objects.equals(sellerId, that.sellerId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(bookid, bookname, price, category, imageurl, sellerId);
+ }
+}
diff --git a/HibernateTest/src/table/OrderEntity.hbm.xml b/HibernateTest/src/table/OrderEntity.hbm.xml
new file mode 100644
index 0000000..33b7094
--- /dev/null
+++ b/HibernateTest/src/table/OrderEntity.hbm.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/src/table/OrderEntity.java b/HibernateTest/src/table/OrderEntity.java
new file mode 100644
index 0000000..cb2be1a
--- /dev/null
+++ b/HibernateTest/src/table/OrderEntity.java
@@ -0,0 +1,69 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "order", schema = "xianshu", catalog = "")
+public class OrderEntity {
+ private int orderId;
+ private Integer buyerId;
+ private Integer sellerId;
+ private Integer bookId;
+
+ @Id
+ @Column(name = "orderId")
+ public int getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(int orderId) {
+ this.orderId = orderId;
+ }
+
+ @Basic
+ @Column(name = "BuyerID")
+ public Integer getBuyerId() {
+ return buyerId;
+ }
+
+ public void setBuyerId(Integer buyerId) {
+ this.buyerId = buyerId;
+ }
+
+ @Basic
+ @Column(name = "sellerID")
+ public Integer getSellerId() {
+ return sellerId;
+ }
+
+ public void setSellerId(Integer sellerId) {
+ this.sellerId = sellerId;
+ }
+
+ @Basic
+ @Column(name = "bookID")
+ public Integer getBookId() {
+ return bookId;
+ }
+
+ public void setBookId(Integer bookId) {
+ this.bookId = bookId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ OrderEntity that = (OrderEntity) o;
+ return orderId == that.orderId &&
+ Objects.equals(buyerId, that.buyerId) &&
+ Objects.equals(sellerId, that.sellerId) &&
+ Objects.equals(bookId, that.bookId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(orderId, buyerId, sellerId, bookId);
+ }
+}
diff --git a/HibernateTest/src/table/ShopcartEntity.hbm.xml b/HibernateTest/src/table/ShopcartEntity.hbm.xml
new file mode 100644
index 0000000..603813b
--- /dev/null
+++ b/HibernateTest/src/table/ShopcartEntity.hbm.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/src/table/ShopcartEntity.java b/HibernateTest/src/table/ShopcartEntity.java
new file mode 100644
index 0000000..6647cc7
--- /dev/null
+++ b/HibernateTest/src/table/ShopcartEntity.java
@@ -0,0 +1,57 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "shopcart", schema = "xianshu", catalog = "")
+public class ShopcartEntity {
+ private int cartId;
+ private Integer userId;
+ private Integer bookid;
+
+ @Id
+ @Column(name = "cartID")
+ public int getCartId() {
+ return cartId;
+ }
+
+ public void setCartId(int cartId) {
+ this.cartId = cartId;
+ }
+
+ @Basic
+ @Column(name = "userID")
+ public Integer getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Integer userId) {
+ this.userId = userId;
+ }
+
+ @Basic
+ @Column(name = "bookid")
+ public Integer getBookid() {
+ return bookid;
+ }
+
+ public void setBookid(Integer bookid) {
+ this.bookid = bookid;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ShopcartEntity that = (ShopcartEntity) o;
+ return cartId == that.cartId &&
+ Objects.equals(userId, that.userId) &&
+ Objects.equals(bookid, that.bookid);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(cartId, userId, bookid);
+ }
+}
diff --git a/HibernateTest/src/table/UserEntity.hbm.xml b/HibernateTest/src/table/UserEntity.hbm.xml
new file mode 100644
index 0000000..a07dd51
--- /dev/null
+++ b/HibernateTest/src/table/UserEntity.hbm.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/src/table/UserEntity.java b/HibernateTest/src/table/UserEntity.java
new file mode 100644
index 0000000..302f522
--- /dev/null
+++ b/HibernateTest/src/table/UserEntity.java
@@ -0,0 +1,81 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "user", schema = "xianshu", catalog = "")
+public class UserEntity {
+ private int userId;
+ private String userName;
+ private String password;
+ private String school;
+ private String sex;
+
+ @Id
+ @Column(name = "userID")
+ public int getUserId() {
+ return userId;
+ }
+
+ public void setUserId(int userId) {
+ this.userId = userId;
+ }
+
+ @Basic
+ @Column(name = "userName")
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Basic
+ @Column(name = "password")
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @Basic
+ @Column(name = "school")
+ public String getSchool() {
+ return school;
+ }
+
+ public void setSchool(String school) {
+ this.school = school;
+ }
+
+ @Basic
+ @Column(name = "sex")
+ public String getSex() {
+ return sex;
+ }
+
+ public void setSex(String sex) {
+ this.sex = sex;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UserEntity that = (UserEntity) o;
+ return userId == that.userId &&
+ Objects.equals(userName, that.userName) &&
+ Objects.equals(password, that.password) &&
+ Objects.equals(school, that.school) &&
+ Objects.equals(sex, that.sex);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(userId, userName, password, school, sex);
+ }
+}
diff --git a/HibernateTest/src/test/StudentsTest.java b/HibernateTest/src/test/StudentsTest.java
new file mode 100644
index 0000000..8bd8d7a
--- /dev/null
+++ b/HibernateTest/src/test/StudentsTest.java
@@ -0,0 +1,68 @@
+
+package test;
+
+import table.BookEntity;
+import org.hibernate.*;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Date;
+
+/**
+ * 这里是测试类
+ */
+public class StudentsTest {
+
+ private SessionFactory sessionFactory;
+ private Session session;
+ private Transaction transaction;
+
+
+
+
+ @Before
+ public void init(){
+ //创建配置对象
+ Configuration config = new Configuration().configure();
+ //创建服务注册对象
+ // ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();(使用这种方法会报错,unkonw Entity 。。。。)
+ ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure().build();
+ //创建会话工厂对象
+
+ sessionFactory = config.buildSessionFactory(serviceRegistry);
+ //创建会话对象
+ session = sessionFactory.openSession();
+ //开启事务
+ transaction = session.beginTransaction();
+ }
+
+
+ @Test
+ public void testSaveStudents(){
+ BookEntity s = new BookEntity();
+ s.setBookid(2);
+ s.setBookname("李丽丽啊");
+ s.setPrice(10);
+ s.setCategory("语文");
+ session.save(s);//保存对象进入数据库
+ }
+
+ @After
+ public void destory(){
+ //提交事务
+ transaction.commit();
+ //关闭session
+ try {
+ session.close();
+ }catch(Exception e){
+
+ }
+ //关闭sessionFactory
+ sessionFactory.close();
+ }
+}
diff --git a/HibernateTest/web/WEB-INF/web.xml b/HibernateTest/web/WEB-INF/web.xml
new file mode 100644
index 0000000..d80081d
--- /dev/null
+++ b/HibernateTest/web/WEB-INF/web.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/HibernateTest/web/index.jsp b/HibernateTest/web/index.jsp
new file mode 100644
index 0000000..fe2125c
--- /dev/null
+++ b/HibernateTest/web/index.jsp
@@ -0,0 +1,16 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: TANGNAN
+ Date: 2020/1/2
+ Time: 14:21
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ $Title$
+
+
+ $END$
+
+
diff --git a/src/Main.java b/src/Main.java
new file mode 100644
index 0000000..61bfb95
--- /dev/null
+++ b/src/Main.java
@@ -0,0 +1,47 @@
+import org.hibernate.HibernateException;
+import org.hibernate.Metamodel;
+import org.hibernate.query.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+import javax.persistence.metamodel.EntityType;
+
+import java.util.Map;
+
+public class Main {
+ private static final SessionFactory ourSessionFactory;
+
+ static {
+ try {
+ Configuration configuration = new Configuration();
+ configuration.configure();
+
+ ourSessionFactory = configuration.buildSessionFactory();
+ } catch (Throwable ex) {
+ throw new ExceptionInInitializerError(ex);
+ }
+ }
+
+ public static Session getSession() throws HibernateException {
+ return ourSessionFactory.openSession();
+ }
+
+ public static void main(final String[] args) throws Exception {
+ final Session session = getSession();
+ try {
+ System.out.println("querying all the managed entities...");
+ final Metamodel metamodel = session.getSessionFactory().getMetamodel();
+ for (EntityType> entityType : metamodel.getEntities()) {
+ final String entityName = entityType.getName();
+ final Query query = session.createQuery("from " + entityName);
+ System.out.println("executing: " + query.getQueryString());
+ for (Object o : query.list()) {
+ System.out.println(" " + o);
+ }
+ }
+ } finally {
+ session.close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/hibernate.cfg.xml b/src/hibernate.cfg.xml
new file mode 100644
index 0000000..3df5d08
--- /dev/null
+++ b/src/hibernate.cfg.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ jdbc:mysql://localhost:3306/xianshu
+ com.mysql.jdbc.Driver
+
+ root
+ 123456
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/table/BookEntity.hbm.xml b/src/table/BookEntity.hbm.xml
new file mode 100644
index 0000000..dd709b9
--- /dev/null
+++ b/src/table/BookEntity.hbm.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/table/BookEntity.java b/src/table/BookEntity.java
new file mode 100644
index 0000000..ccceaf6
--- /dev/null
+++ b/src/table/BookEntity.java
@@ -0,0 +1,93 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "book", schema = "xianshu", catalog = "")
+public class BookEntity {
+ private int bookid;
+ private String bookname;
+ private Integer price;
+ private String category;
+ private String imageurl;
+ private Integer sellerId;
+
+ @Id
+ @Column(name = "bookid")
+ public int getBookid() {
+ return bookid;
+ }
+
+ public void setBookid(int bookid) {
+ this.bookid = bookid;
+ }
+
+ @Basic
+ @Column(name = "bookname")
+ public String getBookname() {
+ return bookname;
+ }
+
+ public void setBookname(String bookname) {
+ this.bookname = bookname;
+ }
+
+ @Basic
+ @Column(name = "price")
+ public Integer getPrice() {
+ return price;
+ }
+
+ public void setPrice(Integer price) {
+ this.price = price;
+ }
+
+ @Basic
+ @Column(name = "category")
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ @Basic
+ @Column(name = "imageurl")
+ public String getImageurl() {
+ return imageurl;
+ }
+
+ public void setImageurl(String imageurl) {
+ this.imageurl = imageurl;
+ }
+
+ @Basic
+ @Column(name = "sellerID")
+ public Integer getSellerId() {
+ return sellerId;
+ }
+
+ public void setSellerId(Integer sellerId) {
+ this.sellerId = sellerId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ BookEntity that = (BookEntity) o;
+ return bookid == that.bookid &&
+ Objects.equals(bookname, that.bookname) &&
+ Objects.equals(price, that.price) &&
+ Objects.equals(category, that.category) &&
+ Objects.equals(imageurl, that.imageurl) &&
+ Objects.equals(sellerId, that.sellerId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(bookid, bookname, price, category, imageurl, sellerId);
+ }
+}
diff --git a/src/table/OrderEntity.hbm.xml b/src/table/OrderEntity.hbm.xml
new file mode 100644
index 0000000..33b7094
--- /dev/null
+++ b/src/table/OrderEntity.hbm.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/table/OrderEntity.java b/src/table/OrderEntity.java
new file mode 100644
index 0000000..cb2be1a
--- /dev/null
+++ b/src/table/OrderEntity.java
@@ -0,0 +1,69 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "order", schema = "xianshu", catalog = "")
+public class OrderEntity {
+ private int orderId;
+ private Integer buyerId;
+ private Integer sellerId;
+ private Integer bookId;
+
+ @Id
+ @Column(name = "orderId")
+ public int getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(int orderId) {
+ this.orderId = orderId;
+ }
+
+ @Basic
+ @Column(name = "BuyerID")
+ public Integer getBuyerId() {
+ return buyerId;
+ }
+
+ public void setBuyerId(Integer buyerId) {
+ this.buyerId = buyerId;
+ }
+
+ @Basic
+ @Column(name = "sellerID")
+ public Integer getSellerId() {
+ return sellerId;
+ }
+
+ public void setSellerId(Integer sellerId) {
+ this.sellerId = sellerId;
+ }
+
+ @Basic
+ @Column(name = "bookID")
+ public Integer getBookId() {
+ return bookId;
+ }
+
+ public void setBookId(Integer bookId) {
+ this.bookId = bookId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ OrderEntity that = (OrderEntity) o;
+ return orderId == that.orderId &&
+ Objects.equals(buyerId, that.buyerId) &&
+ Objects.equals(sellerId, that.sellerId) &&
+ Objects.equals(bookId, that.bookId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(orderId, buyerId, sellerId, bookId);
+ }
+}
diff --git a/src/table/ShopcartEntity.hbm.xml b/src/table/ShopcartEntity.hbm.xml
new file mode 100644
index 0000000..603813b
--- /dev/null
+++ b/src/table/ShopcartEntity.hbm.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/table/ShopcartEntity.java b/src/table/ShopcartEntity.java
new file mode 100644
index 0000000..6647cc7
--- /dev/null
+++ b/src/table/ShopcartEntity.java
@@ -0,0 +1,57 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "shopcart", schema = "xianshu", catalog = "")
+public class ShopcartEntity {
+ private int cartId;
+ private Integer userId;
+ private Integer bookid;
+
+ @Id
+ @Column(name = "cartID")
+ public int getCartId() {
+ return cartId;
+ }
+
+ public void setCartId(int cartId) {
+ this.cartId = cartId;
+ }
+
+ @Basic
+ @Column(name = "userID")
+ public Integer getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Integer userId) {
+ this.userId = userId;
+ }
+
+ @Basic
+ @Column(name = "bookid")
+ public Integer getBookid() {
+ return bookid;
+ }
+
+ public void setBookid(Integer bookid) {
+ this.bookid = bookid;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ShopcartEntity that = (ShopcartEntity) o;
+ return cartId == that.cartId &&
+ Objects.equals(userId, that.userId) &&
+ Objects.equals(bookid, that.bookid);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(cartId, userId, bookid);
+ }
+}
diff --git a/src/table/UserEntity.hbm.xml b/src/table/UserEntity.hbm.xml
new file mode 100644
index 0000000..a07dd51
--- /dev/null
+++ b/src/table/UserEntity.hbm.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/table/UserEntity.java b/src/table/UserEntity.java
new file mode 100644
index 0000000..302f522
--- /dev/null
+++ b/src/table/UserEntity.java
@@ -0,0 +1,81 @@
+package table;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+@Entity
+@Table(name = "user", schema = "xianshu", catalog = "")
+public class UserEntity {
+ private int userId;
+ private String userName;
+ private String password;
+ private String school;
+ private String sex;
+
+ @Id
+ @Column(name = "userID")
+ public int getUserId() {
+ return userId;
+ }
+
+ public void setUserId(int userId) {
+ this.userId = userId;
+ }
+
+ @Basic
+ @Column(name = "userName")
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Basic
+ @Column(name = "password")
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @Basic
+ @Column(name = "school")
+ public String getSchool() {
+ return school;
+ }
+
+ public void setSchool(String school) {
+ this.school = school;
+ }
+
+ @Basic
+ @Column(name = "sex")
+ public String getSex() {
+ return sex;
+ }
+
+ public void setSex(String sex) {
+ this.sex = sex;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ UserEntity that = (UserEntity) o;
+ return userId == that.userId &&
+ Objects.equals(userName, that.userName) &&
+ Objects.equals(password, that.password) &&
+ Objects.equals(school, that.school) &&
+ Objects.equals(sex, that.sex);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(userId, userName, password, school, sex);
+ }
+}
diff --git a/src/test/StudentsTest.java b/src/test/StudentsTest.java
new file mode 100644
index 0000000..8bd8d7a
--- /dev/null
+++ b/src/test/StudentsTest.java
@@ -0,0 +1,68 @@
+
+package test;
+
+import table.BookEntity;
+import org.hibernate.*;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistry;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.sql.Date;
+
+/**
+ * 这里是测试类
+ */
+public class StudentsTest {
+
+ private SessionFactory sessionFactory;
+ private Session session;
+ private Transaction transaction;
+
+
+
+
+ @Before
+ public void init(){
+ //创建配置对象
+ Configuration config = new Configuration().configure();
+ //创建服务注册对象
+ // ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();(使用这种方法会报错,unkonw Entity 。。。。)
+ ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure().build();
+ //创建会话工厂对象
+
+ sessionFactory = config.buildSessionFactory(serviceRegistry);
+ //创建会话对象
+ session = sessionFactory.openSession();
+ //开启事务
+ transaction = session.beginTransaction();
+ }
+
+
+ @Test
+ public void testSaveStudents(){
+ BookEntity s = new BookEntity();
+ s.setBookid(2);
+ s.setBookname("李丽丽啊");
+ s.setPrice(10);
+ s.setCategory("语文");
+ session.save(s);//保存对象进入数据库
+ }
+
+ @After
+ public void destory(){
+ //提交事务
+ transaction.commit();
+ //关闭session
+ try {
+ session.close();
+ }catch(Exception e){
+
+ }
+ //关闭sessionFactory
+ sessionFactory.close();
+ }
+}