Helma Logo
helma.org » Home > docs > guide > mapping > Object Reference Mappings

Object Reference Mappings

Properties that contain other objects are defined by the object keyword and the prototype name of the referenced object in brackets. The object reference is resolved via two entries:

prop3 = object (protoype) 
prop3.local = LOCAL_DB_COLUMN 
prop3.foreign = FOREIGN_DB_COLUMN
prop3.local specifies the part of the reference in the local database-table, prop3.foreign the column in the table where objects of the referenced prototype are stored. By executing the assignment obj.prop3 = someObject, the database-column specified by prop3.local will be set to the value of FOREIGN_DB_COLUMN, or null if someObject == null.


Up: Object-Relational Mapping Guide
Previous: Simple Property Mappings Next: Collection Mappings

... comment


Page last modified on 2002-04-23 17:28 by hns

 
maks, Monday, 6. March 2006, 09:16
Do not include a property mapping for object ref column!
Be careful NOT to include a proeprty mapping for a column used in a object reference mapping, as this will stop the object reference from working!
eg. if you have the above prop3 reference mapping, do *NOT* include:
prop3 = LOCAL_DB_COLUMN

... link  


... comment
 
andi, Thursday, 24. May 2007, 16:50
prop3.local could be remembered as prop3.localColumnWithForeignKey
prop3.foreign could be remembered as prop3.foreignColumnWithLocalKey

... link  


... comment