Hi,
I can't get this simple test case to work, i know it is probably due to the lack of proper annotations on entities list, could anyone help me to define them?
NB in this test case I didn't set all entities methods for the sake of clarity, also in actual application no field are public nor static and no entity is static.
package testodb; import java.io.File; import java.io.Serializable; import java.util.List; import javax.persistence.Entity; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Persistence; import javax.persistence.TypedQuery; public class TestODB implements Serializable { public static void main(String[] args) { Tester t = new Tester(); t.test(); } public static class Tester { EntityManagerFactory emf; EntityManager em; public void test(){ openDB(); em = emf.createEntityManager(); em.getTransaction().begin(); OrderDat ord = new OrderDat(new CustomerDat("customer name"),null); System.out.println("order.name: "+ord.customer.name); em.persist(ord); em.getTransaction().commit(); em.flush(); em.close(); //closeDB(); //openDB(); em = emf.createEntityManager(); TypedQuery<OrderDat> query = em.createQuery("SELECT ord FROM OrderDat ord", OrderDat.class); System.out.println("result.order.name: "+query.getResultList().get(0).customer.name); em.close(); closeDB(); } void openDB(){ //System.setProperty("objectdb.conf", // System.getProperty("user.home")+"objectdb.conf"); emf = Persistence.createEntityManagerFactory( "objectdb:$objectdb/db/test3.tmp"); //;drop } void closeDB(){ emf.close(); new File("objectdb:$objectdb/db/test3.tmp").delete(); } @Entity public static class OrderDat implements Serializable { @Id @GeneratedValue private long id; public List<ItemDat> items; public CustomerDat customer; public OrderDat(CustomerDat customer,List<ItemDat> items){ this.customer = customer; this.items = items; } public long getId() { return id; } public void setId(long id) { this.id = id; } } @Entity public static class ItemDat implements Serializable { @Id @GeneratedValue private long id; public List<String> image; public List<ApiIDDat> apiId; public ItemDat(List<ApiIDDat> apiId){ this.apiId = apiId; } public long getId() { return id; } public void setId(long id) { this.id = id; } } @Entity public static class CustomerDat implements Serializable { @Id @GeneratedValue private long id; public List<ApiIDDat> apiId; public String name; public CustomerDat(String name){ this.name = name; } public long getId() { return id; } public void setId(long id) { this.id = id; } } @Entity public static class ApiIDDat implements Serializable { @Id @GeneratedValue private long id; public String identifier; public String apiName; public ApiIDDat(String apiNam,String ident){ apiName = apiNam; identifier = ident; } public long getId() { return id; } public void setId(long id) { this.id = id; } } } }