No Persistence provider for EntityManager named

前端 未结 30 2429
甜味超标
甜味超标 2020-11-22 03:45

I have my persistence.xml with the same name using TopLink under the META-INF directory. Then, I have my code calling it with:

30条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 04:46

    If you are using Eclipse make sure that exclusion pattern does not remove your persistence.xml from source folders on build path.

    1. Go to Properties -> Java Build Path -> Source tab
    2. Check your exclusion pattern which is located at
      MyProject/src/main/java -> Excluded:
      tree node
    3. Optionally, set it to Excluded: (None) by selecting the node and clicking Edit... button on the left.

提交回复
热议问题