Alias does not get initialized..

@Entity
public class Foo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long id;

@Basic
public Key bar;

@OneToOne(fetch = FetchType.LAZY)
@Column(name = "bar", insertable = false, updatable = false)
public Bar barAlias;
}

@Entity
public class Bar {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Key key;

@Basic
public String name;
}

public class UnOwnedRelationshipTest extends BaseDataStoreTest {

public void testRelation() throws EntityNotFoundException {

Bar bar = new Bar();
beginTx();
getEntityManager().persist(bar);
commitTx();

beginTx();
Foo pojo = new Foo();
pojo.bar = bar.key;
getEntityManager().persist(pojo);
commitTx();

pojo = getEntityManager().find(Foo.class, pojo.id);
com.google.appengine.api.datastore.Entity e = DatastoreServiceFactory
.getDatastoreService().get(KeyFactory.createKey("Foo", pojo.id));
assertTrue(e.hasProperty("bar"));

//this fails
assertNotNull(pojo.barAlias);

}
}

The test fails, alias is not initialized..
It does not work even when I use getters/setters to access alias, Neither it
works for @oneToMany as you explained in example.

I use GAE SDK 1.3.2

When using joins,  From Foo result returned, can I do
foor.getBarAlias().getName() !??
-- 
Sudhir Ramanandi
http://www.ramanandi.org

-- 
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to