On Tue, Dec 29, 2009 at 11:31 PM, Alex Shneyderman
<[email protected]> wrote:
> I am using associations and properties for non-persistent objects (as
> transient composites). I kind of like how I do not have to deal with
> state keeping business. It works quite well for Property<Object> prop
> type of declarations. But associations and many associations do not
> work since objects have to be entity composites.
>
> So, I wonder why is this hard coded dependency needed? Can't this be
> re-factored?
I think the real reason for the hard coded way it is, is two-folded.
1. We didn't expect that Transients were going to be used very much,
and people would almost always use either Values or Entities.
2. In the resolution of Associations in the retrieval of an Entity,
the UoW needs to know exactly which EntityComposite type that is used
(visibility can't apply here). So, for Entities the exact composite
type is really needed, unless (I think) we place additional burden on
the EntityStore to resolve the referred type for the UnitOfWork, which
brings additional hazard of classloading that we have really tried to
keep out of the system.
So, I am not sure that it is an unsolvable issue or not, but it was a
compromise at the time to get it to work properly.
In this context, I may mention that we previously also attempted to
support "qualified associations", i.e. additional meta-data could be
contained within the association itself;
It was something like;
public interface FriendAssociation extends Association
{
Property<Date> since();
}
public interface Person
{
ManyAssociation<QualifiedAssociation<Person, FriendAssociation>> friends();
}
(Perhaps don't remember the syntax correctly.)
But this ended up being too hard to get to work in reality, so the
feature was taken out of the first round of implementation, to be
reconsidered for later. At that time the genericized type of
(Many)Association was indeed Object...
Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/2qq9er
I work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev