Eclipse does not recognize content of persistence.xml

前端 未结 27 1802
野趣味
野趣味 2021-01-30 20:44

Im getting the following error in eclipse:

The persistence.xml file does not have recognized content.

My persistence.xml file works great in my application but e

27条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 21:11

    Turning this error into a warning may make the problem go away, but it will not fix the underlying problem with the Eclipse Dali plugin. It will also mean the extremely useful JPA Structure and JPA Details views will not work.

    The link offered by OP and the approach of most of the answers here are actually meant to get around a different problem wherein Maven wants to filter the persistence.xml file and thus tells Eclipse to ignore it. A viable work-around for that problem is explained here and involves removing the exclused: '**' from the src/main/resources entry in the classpath in the project properties.

    Back to the OP's original question, I had this EXACT same error message (which in and off itself tells you that the persistence.xml file has been located). For me the solution was to change the persistence XML element from this:

    
    

    to this:

    
    

    Once changed, the error went away and Dali instantly came alive and now everything Just Works. Hope this helps somebody someday.

提交回复
热议问题