gpt4 book ai didi

java - 如何在 persistence.xml 中指定 JPA 2.1?

转载 作者:IT老高 更新时间:2023-10-28 20:24:18 27 4
gpt4 key购买 nike

在网络上的快速搜索显示了人们在 persistence.xml 中指定 xmlnsxsi:schemaLocation 的三四个变体。

指定 JPA 2.1 版的“正确”方式是什么?

我正在使用

<persistence version="2.1"
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_1.xsd">

最佳答案

根据official documentation它一定是(和你的一样):

<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_1.xsd"
version="2.1">
...
</persistence>

关于java - 如何在 persistence.xml 中指定 JPA 2.1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21142168/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com