The error occurs if more then one persistence unit is found. Note that by default, classpath* is used to search for xml files which means that not just folders but also jars added to the classpath are used in the lookup process.
Make sure you have indeed only one persistence unit info declared or add its name to the LocalContainerEMFB.
Make sure you have indeed only one persistence unit info declared or add its name to the LocalContainerEMFB.
配置了这个,不是自动搜索本地持久单元吗??为什么不行呢??、!!
TSS上有好几篇文章介绍!就是你这个问题的!
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_1_0.xsd"
version="1.0">
<persistence-unit name="项目" transaction-type="RESOURCE_LOCAL">
</persistence-unit>
</persistence>
位置是:项目\src\META-INF,并且你的这个目录之下还有别的文件么?
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />