I am working on a small demo for my jaoo tutorial.
What way of working would you suggest for returning references to entities
outside of the uow for later reference?
Right now I just return the entities and have them later reloaded when passed into a new function (as the uow they
originated from is closed). This also limits any access to any attribute of the entity, including identity() and type()
both of which are important for the reload.
Funnily the id is equal to the toString() of the entity. So I do reload as
follows:
public void attendPresentation(Presentation presentation, Attendee
attendee) {
reload(Attendee.class, attendee).attend(reload(Presentation.class,
presentation));
}
private <T extends EntityComposite> T reload(Class<T> type, T entity) {
return uow().get(type, entity.toString());
}
what I'd like to do would be:
private <T extends EntityComposite> T reload(T entity) {
return uow().get(entity.type(), entity.identity());
}
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev