ColdFusion: ORM Collection with Multiple Foreign Keys -


my database structure consists of multiple primary keys per table, therefore multiple columns required per join. i'm trying use coldfusion (11 specific) orm collection property. seems comma separated list of columns in fkcolumn attribute doesn't work, relationship properties. have filed bug adobe, i'm wondering if else has run , found workarounds. or maybe i'm doing wrong..

table setup

years        staff         staffsites    sites ===========  ============  ============  =========== yearid (pk)  staffid (pk)  yearid (pk)   siteid (pk) yearname     staffname     staffid (pk)  sitename                            siteid (pk) 

staff orm cfc

component persistent=true table='staff' {     property name='id'    column='staffid'       fieldtype='id';     property name='year'  column='yearid'        fieldtype='id';     property name='sites' elementcolumn='siteid' fieldtype='collection' table='staffsites' fkcolumn='staffid,yearid'; } 

the problem

there error when running generated query: [macromedia][sqlserver jdbc driver][sqlserver]an expression of non-boolean type specified in context condition expected, near ','.

taking @ generated query, appears list of columns not parsed where clause, understands there multiple columns in select expression.

select     sites0_.staffid,     yearid staffid1_2_0_,     sites0_.siteid siteid4_0_      staffsites sites0_      sites0_.staffid,yearid=? 

the goal

for orm collection property correctly support multi-key "join". why not use relationship? i'd use orm objects serialize json use in rest services. serialized json needs contain id relationships, not actual relationship data. example, json payload should be:

{     "id": 1234,     "year": 2015,     "sites": [1,2,3] } 

instead of like:

{     "id": 1234,     "year": 2015,     "sites": [         {"id": 1, "name": "foo"},         {"id": 2, "name": "bar"},         {"id": 3, "name": "baz"},     ] } 

for db structure, simplest way translate orm use "staffsites" linktable many-to-many relationships.

you should try cf11's custom serializer http://blogs.coldfusion.com/post.cfm/language-enhancements-in-coldfusion-splendor-improved-json-serialization-2


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -