亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法構建實體管理器工廠 - JPA/Hibernate

無法構建實體管理器工廠 - JPA/Hibernate

暮色呼如 2023-07-28 16:00:29
我想將帶有 hibernate/jpa 的數據庫添加到我的 java 應用程序中,但我收到各種錯誤消息,表明無法構建實體管理器工廠并且存在錯誤的時區(我猜我可以在本地服務器上修復)。我的 persistence.xml:<?xml version="1.0" encoding="UTF-8"?><persistence xmlns="http://java.sun.com/xml/ns/persistence"             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"             version="2.0">    <persistence-unit name="org.hibernate.tutorial.jpa">        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>        <properties>            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/golist2019"/>            <property name="hibernate.connection.autocommit" value="false"/>            <property name="hibernate.connection.username" value="root"/>            <property name="hibernate.connection.password" value="root"/>            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>            <property name="hibernate.connection.CharSet" value="utf8"/>            <property name="hibernate.connection.characterEncoding" value="utf8"/>            <property name="hibernate.connection.useUnicode" value="true"/>            <property name="hibernate.show_sql" value="true"/>            <property name="hibernate.hbm2ddl.auto" value="update"/>            <!-- use encache provider-->            <!--<property name="hibernate.cache.region.factory_class"-->        </properties>    </persistence-unit></persistence>
查看完整描述

2 回答

?
GCT1015

TA貢獻1827條經驗 獲得超4個贊

修正你的時區!:

引起原因:com.mysql.cj.exceptions.InvalidConnectionAttributeException:服務器時區值“Mitteleurop?ische Sommerzeit”無法識別或代表多個時區。如果要利用時區支持,則必須配置服務器或 JDBC 驅動程序(通過 serverTimezone 配置屬性)以使用更具體的時區值。


查看完整回答
反對 回復 2023-07-28
?
繁花如伊

TA貢獻2012條經驗 獲得超12個贊

在 persistence.xml 中,將 hibernate.connection.url 更改為:

jdbc:mysql://localhost:3306/golist2019&serverTimezone=歐洲/阿姆斯特丹


查看完整回答
反對 回復 2023-07-28
  • 2 回答
  • 0 關注
  • 144 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號