Hi,
I struggle with a strange issue. I've embedded ObjectDB in a small application
to query cases. Within Netbeans everything works fine but when I create
a JAR File and executed via "Java -Jar xyz.jar", I get either empty results or on
some cases a "NoResultException" which appears to report the same issue.
I've created a small test case (attached zip file) with a sample DB to reproduce the issue.
In essence, I've just annotated my beans, created a file as storage and
imported some data. The main class of the test case looks like this:
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "src/main/resources/TravelDB.odb"); EntityManager em = emf.createEntityManager(); String s = "SELECT c FROM Case c"; TypedQuery<Case> q = em.createQuery(s, Case.class); List<Case> allCases = q.getResultList(); for (Case c1 : allCases) { System.out.println(c1.getCaseId());
In Netbeans, the code is working but once the Jar File is created and moved to a different folder,
the query does not return any results any more.
What do I wrong?
Do I need any additional configuration to deploy ObjectDB correctly to a Jar file that can be distributed?
Thanks for any help.