新增persistence.xml
Change-Id: Iac5541dce4055472e09ea140b9a277c2918ca01e
diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..3d68dc9
--- /dev/null
+++ b/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,34 @@
+<persistence 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_2.xsd"
+ version="2.2">
+
+ <persistence-unit name="myPersistenceUnit">
+ <!-- 指定 JPA 提供者 -->
+ <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
+
+ <!-- 注册实体类 -->
+ <class>object.Seed</class>
+ <class>object.User</class>
+ <class>object.UserPT</class>
+ <class>object.Notice</class>
+ <class>object.BegInfo</class>
+ <class>object.Post</class>
+ <class>object.Profile</class>
+
+ <!-- 数据库连接配置 -->
+ <properties>
+ <property name="javax.persistence.jdbc.url" value="${DB_URL}"/>
+ <property name="javax.persistence.jdbc.user" value="${DB_USER}"/>
+ <property name="javax.persistence.jdbc.password" value="${DB_PASSWORD}"/>
+ <property name="javax.persistence.jdbc.driver" value="${DB_DRIVER}"/>
+
+ <!-- Hibernate 配置 -->
+ <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.show_sql" value="true"/>
+ </properties>
+ </persistence-unit>
+
+</persistence>