I thought about it the other day: do we need a separate version property if we 
have last-modified? Isn't that enough to 
check for changes?

Michael

-------- Original-Nachricht --------
Betreff: [qi4j-dev] Entity metadata as Properties
Datum: Mon, 18 Aug 2008 12:33:26 +0800
Von: Rickard Öberg <[EMAIL PROTECTED]>
Antwort an: [email protected]
An: Qi4j Dev <[email protected]>

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

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

Reply via email to