Hey,

Right now Entity metadata such as version and last-modified is handled 
separately from other Properties. This makes it impossible to use 
queries with them, which sometimes would be convenient (e.g. "list all 
entities modified after date X").

I would suggest that we change so that version and last-modified become 
real Properties, declared in Entity interface like so:
ComputedProperty<long> version();
ComputedProperty<long> lastModified();
and then the EntityStore updates them as per usual. This would enable 
querying of this data quite easily:
// Find entities modified the last minute
QueryBuilder<Entity> entities = qbf.newQueryBuilder(Entity.class);
Entity entity = templateFor( Entity.class );
entities.where(
   gt( entity.lastModified(), new Date().getTime()-60000 );
);
Query<Nameable> query = qb.newQuery();
---

For caching purposes there are also other kinds of metadata that would 
make sense to add as Entity Properties, such as Expires and MaxAge. 
Especially MaxAge would be nice to have as a Property, because then we 
can set per-instance what is the allowed caching policy through the 
usual UnitOfWork mechanism. Neat!

Anyone see drawbacks with making this metadata as Properties?

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to