Error in finding the mapping file in the JPA in the persistence.xml file

已回答

Below is persistence.xml file, contents

<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_2.xsd"
             version="2.2">

    <persistence-unit name="main-persistence-unit">

        <mapping-file>student.xml</mapping-file>----Error: can not resolve student.xml file.

        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/jpa_db"/>
            <property name="javax.persistence.jdbc.user" value="root"/>
            <property name="javax.persistence.jdbc.password" value="root"/>

            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="true"/>
        </properties>

0

Hello,

Is it possible to provide sample project example for investigation?

0

Attaching the screen shot.

0

As we see in the screen shot, persistence.xml not able to resolve student.xml in the <maping-file> tag.

Even I have created META-INF folder in the resources folder and move persistence.xml file inside it and provided the reference path in the <mapping-file>student.xml<mapping-file> but it is not able to resolve the student.xml file. 

Even I moved persistence.xml file outside META-INF folder , even then not able to resolve student.xml under <mapping-file> tag.Please advice.

0

Thanks!

I reported issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-340525

Please follow it for updates.

0

请先登录再写评论。