在IntelliJ 2016.2旗舰版中,如何在不使用persistence.xml时添加JPA facet?

时间:2016-08-11 10:17:58

标签: intellij-idea

我的项目没有persistence.xml。 我在基于spring-boot的应用程序中使用注释。 如何添加JPA方面? 当我尝试添加一个jpa facet时,它强制我选择persistence.xml,如果它不存在,它会尝试创建一个我不想要的。

任何人都可以帮我吗?

1 个答案:

答案 0 :(得分:0)

现在,我在项目的 META-INF 文件夹中使用了近乎空的 persistence.xml 。 在此之后它工作正常,但我希望没有这个persistence.xml也可以这样做。

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">
    <persistence-unit name="myPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        <properties>
            <!– Scan for annotated classes and Hibernate mapping XML files –>
            <property name="hibernate.archive.autodetection" value="class" />
        </properties>
    </persistence-unit>
</persistence>

如果有人知道任何其他解决方案,请发表评论。 否则,如果这对您有用,您可以对此答案进行评分: - )

相关问题