I managed to reproduce the issue with a simplified model.
Notice that the same code seemed to pass the test yoesterday...not
today.
I can't attach files so I paste the model here
@PersistenceCapable
class Inner{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;
}
@PersistenceCapable
class Outer{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;
@Persistent
Inner inner;
public Outer(){
inner = new Inner();
}
// public void setInner(Inner in){
// inner = in;
// }
}
@PersistenceCapable
class Container{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
Key key;
@Persistent
ArrayList<Outer> outers;
@Persistent
ArrayList<Inner> inners;
public void addOuters( int n){
outers = new ArrayList<Outer>();
for (int i = 0; i < n; i++){
outers.add(new Outer());
}
}
public void addInners(int n){
inners = new ArrayList<Inner>();
for (int i = 0; i < n; i++){
inners.add(new Inner());
}
}
}
public class TestJDOException {
private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new
LocalDatastoreServiceTestConfig());
private static final PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory("transactions-optional");
@Before
public void setUp() throws Exception {
helper.setUp();
}
@After
public void tearDown() throws Exception {
helper.tearDown();
}
@Test
public void testAddInners(){
Key key = null;
Container container = new Container();
container.addInners(1);
PersistenceManager pm = pmf.getPersistenceManager();
try{
pm.makePersistent(container);
key = container.key;
}
finally{
pm.close();
}
pm = pmf.getPersistenceManager();
try{
container = pm.getObjectById(Container.class, key);
System.out.println(container.inners);
System.out.println(container.outers);
}
finally{
pm.close();
}
}
@Test
public void testAddOuters(){
Key key = null;
Container container = new Container();
container.addOuters(1);
PersistenceManager pm = pmf.getPersistenceManager();
try{
pm.makePersistent(container);
key = container.key;
}
finally{
pm.close();
}
pm = pmf.getPersistenceManager();
try{
container = pm.getObjectById(Container.class, key);
System.out.println(container.inners);
System.out.println(container.outers);
}
finally{
pm.close();
}
}
}
First test passes, second fails. Every test adding Outers fails as
well.
Thanks to everybody
Lorenzo
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.