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

后端 未结 7 2360
孤独总比滥情好
孤独总比滥情好 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:55

    Your META-INF/persistence.xml file should look something like this:

    // 
    //   
    //     oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    //     
    //     entity.Customer
    //     entity.Order
    //     entity.Item
    //     
    //       
    //       
    //       
    //       
    //       
    //       
    //       
    //     
    //   
    // 
    

    Your persistence-unit's name attribute in your persistence.xml doesn't match the value you're passing into the Persistence.createEntityManagerFactory method. Make sure that your persistence-unit name is set to "IRCBotPU".

提交回复
热议问题