Reactor - Using the field tag to to alias duplicate columns
Submitted by Doug Sims on Wed, 2006-07-19 15:55.
coldfusion | reactor
It is mentioned in the Reactor docs that the <field> tag can be used within your object definitions to pretty up ugly column names such as txt_lastname or strCity, but it should also be noted it can be used to diferentiate between two tables which both have fields with the same name.
for example, if all my tables have a modified date timestamp
<object name="User">
<field name="ModifiedDate" alias="UserModifiedDate" />
<hasMany name="Task">
<relate from="Taskid" to="Taskid" />
</hasMany>
</object>
<object name="Task">
<field name="ModifiedDate" alias="TaskModifiedDate" />
<hasOne name="User">
<relate from="UserId" to="UserId" />
</hasOne>
</object>Then, when I am doing a join later, I can reference the modified dates correctly.
» Doug Sims's blog | login or register to post comments | email this page |
delicious |
digg |
reddit |
technorati
delicious |
digg |
reddit |
technorati
