Hi guys,
I am pretty new to Cayenne, and I have a quick one for your guys. I downloaded/running 1.1.
I am having a problem with Validation. Say I have 2 entities Department and Employee.
There is a 1 to many relationship between employee and dep. (1 emp belongs to many dep). This relationship exists between the following fields:
emp.depId and dep.depId.
Now, I have set emp.depId to be isMandatory = true. I.e: I want to enforce that you cannot add an employee without its departement id.
Later, in the code, in a test client class: I am creating an employee and trying to commit it.
>> Result: It allows me to do so (i.e: I only get a cayenneruntimeexception instead of the expected validationexception)!! So, it does not catch the error
until it tries to run the insert against the db...!!
Now, curious to see validation working, I tried to set another employee field emp.empName ( which is the employee name) to be isMandatory=true, and that worked. i.e: validationexception kicked in as expected.
So, it seems to me that fieds others than PKs and FKSs are being validated against the isMandatory, but not the ones involded in relationships.
Can you guys give me a hand...
Sincerely,
Mehdi Bennani
Software Engineer
FreeBalance Inc.
Visit the new FreeBalance website..www.FreeBalance.com
T (613) 236-5150 ext.325
F (613) 236-7785
mbennan..reeBalance.com
This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient(s) please contact the sender by reply email and destroy all copies of the original message and any attachments.
This archive was generated by hypermail 2.0.0 : Tue May 11 2004 - 18:46:54 EDT