Hi,

i am using a pretty straightforward Spring/OpenJPA JUnit Testcase scenario:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "/appContext.xml")
public class DHLLeitcodeCreatorTest {
   ...
   @Test
    public void getDHLLeitcode() {
        someBean.superDuperAction();
   }
}

I am not explicitely declaring my entities in persistence.xml. Its all 
autodetected via Annotations. (at least during normal runtime). 

Inside superDuperAction(), a lot of queries are fired against OpenJPA. It fails 
on the first Query saying that it cant find Entity DP_PLZ_DA (weird class name, 
i know). 

"Error message: The name "DP_PLZ_DA" is not a recognized entity or ...."

Now when i do this:

   @Test
    public void getDHLLeitcode() {
       DP_PLZ_DA df = new DP_PLZ_DA(); 
       someBean.superDuperAction();
   }

It works and it can find the Entity. But why in gods name do i need to 
instantiate the class by myself in order to get detected? During normal 
runtime, this is no problem. Kevin Sutter reported something similar here 
(http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14459507) but i 
thought i can solve this by upgrading to 1.2.2 but i was mistaken.

So why does OpenJPA fail on registering Entities?

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Reply via email to