Hi
Apologies if it is a re-post (I did try to look for a similar issue).
I tried a first very simple test (orders and order items) and I am getting
a strange following result on both 2.1-rc3 and 2.0.
Again, that's my first 5 minutes test and I looked on the net and found
similar test code , so I am not sure what's wrong with it.
May 29, 2015 1:03:10 PM com.orientechnologies.common.log.OLogManager log
INFO: OrientDB auto-config DISKCACHE=10,695MB (heap=3,641MB os=16,384MB
disk=323,721MB)
Order: test with :
[OrderItem: item1 Id: 1 value: 1.0, OrderItem: item2 Id: 2 value: 2.0]
Order: null with :
null
The lines showing null is load from the db after I have saved it. Any light
would be appreciated.
included is the code :
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
package test;
import java.util.ArrayList;
import com.orientechnologies.orient.object.db.OObjectDatabaseTx;
import com.orientechnologies.orient.object.iterator.OObjectIteratorClass;
public class ObjectStorer {
public static void main (String[] args) {
OObjectDatabaseTx tx = new OObjectDatabaseTx ("memory:order").create();
tx.getEntityManager().registerEntityClasses(Order.class.getPackage().getName());
Order o = new Order();
o.setName ("test");
OrderItem i1= new OrderItem() ;
i1.setId ("1");
i1.setName ("item1");
i1.setValue (1);
OrderItem i2= new OrderItem() ;
i2.setId ("2");
i2.setName ("item2");
i2.setValue (2);
o.setItems (new ArrayList<OrderItem> () );
o.getItems().add(i1);
o.getItems().add(i2);
System.out.println (o);
tx.save(o) ;
OObjectIteratorClass<Order> i = tx.browseClass(Order.class) ;
for (Order or : i)
System.out.println (or);
}
}
package test;
import java.util.List;
public class Order {
public Order () { }
protected List<OrderItem> items ;
protected String name ;
public String toString () {
return "Order: " + name + " with : \n" + items ;
}
public List<OrderItem> getItems() {
return items;
}
public void setItems(List<OrderItem> items) {
this.items = items;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package test;
public class OrderItem {
protected String name ;
protected String id ;
protected double value;
public String toString () {
return "OrderItem: " + name + " Id: " + id + " value: " + value ;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getValue() {
return value;
}
public void setValue(double value) {
this.value = value;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}