Unable to access persistent classes via OSGI Service
Environment
- Red Hat JBoss Fuse 6.1.0
Issue
- we are using OpenJPA with Fuse
- when creating the named query with the EntityManagerFactory we are getting the below shown exception:
<openjpa-2.3.0-r422266:1540826 fatal user error> org.apache.openjpa.persistence.ArgumentException: There is no query with the name "ClaimCarrierSequence.findByCareerId" defined for any of the known persistent classes: [foo.model.ClaimCarrierSequence, foo.model.ClaimEventStatus, foo.model.ClaimEventProcessRequest, foo.model.ClaimEventProcessResponse, foo.model.ClaimEvent, foo.model.ClaimEventType].
Resolution
The easiest way to solve this kind of issue with the OpenJPA is to add the package of Entity class using DynamicImport-Package in Manifest file for the bundle which is exposing the OSGI service.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
