Author: TomdeMan
Related Categories:
Transfer, ColdFusion
June 20, 2008
I ran in to this when I first started using Transfer ORM a while back, when I was building a new app. However, now I am curious for those working on an existing app and db structure.
If you have a table called User, for example, Transfer will throw an error. It generates the SQL without brackets [ ] and will usually indicate a syntax error. When really it's the reserved word USER that is throwing things off.
Originally, our team decided to rename the DB table to CoreUser and just map it in the XML to make the object look pretty. Again, this was for a new app we were building so it was early in the game and no additional refactoring was necessary at the time.
<id name="UserId" type="GUID" column="UserId" generate="true" />
I did a quick Google search to see if any posts had mentioned another approach. Nothing new popped up, similar stories and struggles.
I happen to catch Mark online today and figured I'd run it by him. As always Mark hooked me up with a simple effective solution. So simple it made me feel stupid for not trying it.
Add the brackets to the table name in the transfer.xml file.
<id name="UserId" type="GUID" column="UserId" generate="true" />
Cake.





Comments:
[Add Comment]
Will B. says:
Typically, I avoid the word "user" if possible. All my security system tables start with "sec", as in "secUser", "secRights" and so on.
6/20/08 5:16 AM
Anuj Gakhar says:
Not a Transfer expert by any means, but did you try putting dbo.user in the xml file , my understanding is that should work as well.
6/20/08 10:46 AM
Oyun says:
begendim guzel olmus kutlarim ellerinize saglik.
7/7/08 5:12 AM
[Add Comment]