JPA with TopLink: No META-INF/persistence.xml was found in classpath

后端 未结 7 2361
孤独总比滥情好
孤独总比滥情好 2020-12-19 03:04
public class LoginTest {

public static void main(String[] args) {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory(\"IRCBotPU\");
    EntityMan         


        
7条回答
  •  醉酒成梦
    2020-12-19 03:58

    if you are using IntelliJ or a maven project structure you need to place the entire "META-INF/persistence.xml" file in the in resources(src/resources) folder so that it will move your persistence.xml file into "WEB-INF/classes/persistence.xml" location.

    if you are using eclipse or something else makes the changes accordingly so that it will move the file to WEB-INF/classes/persistence.xml

    anything else did not work for me.

提交回复
热议问题