root | 7225234 | 2025-05-11 07:26:52 +0000 | [diff] [blame^] | 1 | <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
| 2 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| 3 | xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
| 4 | http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
|
| 5 | version="2.2">
|
| 6 |
|
| 7 | <persistence-unit name="myPersistenceUnit">
|
| 8 | <!-- 指定 JPA 提供者 -->
|
| 9 | <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
| 10 |
|
| 11 | <!-- 注册实体类 -->
|
| 12 | <class>object.Seed</class>
|
| 13 | <class>object.User</class>
|
| 14 | <class>object.UserPT</class>
|
| 15 | <class>object.Notice</class>
|
| 16 | <class>object.BegInfo</class>
|
| 17 | <class>object.Post</class>
|
| 18 | <class>object.Profile</class>
|
| 19 |
|
| 20 | <!-- 数据库连接配置 -->
|
| 21 | <properties>
|
| 22 | <property name="javax.persistence.jdbc.url" value="${DB_URL}"/>
|
| 23 | <property name="javax.persistence.jdbc.user" value="${DB_USER}"/>
|
| 24 | <property name="javax.persistence.jdbc.password" value="${DB_PASSWORD}"/>
|
| 25 | <property name="javax.persistence.jdbc.driver" value="${DB_DRIVER}"/>
|
| 26 |
|
| 27 | <!-- Hibernate 配置 -->
|
| 28 | <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
|
| 29 | <property name="hibernate.hbm2ddl.auto" value="update"/>
|
| 30 | <property name="hibernate.show_sql" value="true"/>
|
| 31 | </properties>
|
| 32 | </persistence-unit>
|
| 33 |
|
| 34 | </persistence>
|