Hi all,
I have a simple problem for which I can't seem to find a solution
despite searching the wiki and the maillist archives. This of course
doesn't mean the answer isn't in there, I just can't seem to find it
:(
Say I have a POJO, "Person", with an Integer id, first name, last name
(Strings), etc.
Another POJO, "Couple", represents a union between two persons (such
as marriage).
So in Couple I have person1Id and person2Id, which refer to the id's
of the Person's that form the Couple.
I implement the constraints for Person and Couple in separate MetaData
classes, and it mostly works except that I can't figure out how to
have the following constraint: person1Id != person2Id.
I tried this but it doesn't work:
addConstraint(new ConstrainedProperty("person1Id")
.notNull(true)
.manyToOne(Person.class, "id")
);
addConstraint(new ConstrainedProperty("person2Id")
.notNull(true)
.manyToOne(Person.class, "id")
.notEqual(((Couple) retrieveValidatedBean()).getPerson1Id())
);
Generally speaking I can't seem to be able to validate a property
against the value of another property. For example the Person class
has dates for birth and deceased (if applicable), and ideally I want
to validate that the date of deceased is after the date of birth.
One last question, I don't know either how I would validate that a
Couple doesn't already exist in the database, i.e. that the
combination of person1Id and person2Id must be unique.
Anyone can help?
Thanks in advance!
Frederic
--
[EMAIL PROTECTED]
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users