Hello,
I have following object with composite id:
<object name="Security" table="app_security"
decorator="components.core.model.SecurityDecorator">
<compositeid>
<manytoone name="page" />
<manytoone name="user" />
<property name="securityToken" />
</compositeid>
<manytoone name="page" lazy="true">
<link column="id_page" to="app.Page" />
</manytoone>
<manytoone name="user" lazy="true">
<link column="id_user" to="app.User"/>
</manytoone>
<!--
<property name="pageId" type="numeric" column="id_page" />
<property name="userId" type="numeric" column="id_user" />
-->
<property name="securityToken" type="string" column="token" />
<property name="access" type="numeric" />
<property name="moment" type="date" />
</object>
The only problem is that I can not list its records by user & page
properties because of "missing property" errors, for example both these
ways fail:
<cfscript>
qGetSecurity = variables.transfer.listByProperty("app.Security",
"userId", 1);
qGetSecurity = variables.transfer.listByProperty("app.Security",
"user", 1);
</cfscript>
I've tried to add these "missing" properties (see commented piece of
code) -- and listing works this way.
But this breaks saving object because of duplicated id_page and id_user
columns ( MySQL query looks like INSERT (id_user,...,id_user) ):
<cfscript>
beanSecurity = variables.transfer.new("app.Security");
beanSecurity.setSecurityToken("test.test");
beanPage = variables.transfer.get("app.Page", 27);
beanSecurity.setPage(beanPage);
beanUser = variables.transfer.get("app.User", 1);
beanSecurity.setUser(beanUser);
// this wont work with explicitly defined user/page properties
variables.transfer.save(beanSecurity);
</cfscript>
Is it something forbidden for such structure and I should use the o2m
relationships instead for app.Page and app.User?
Problem is that I can not link the app.User o2m collection to the
Security object when using composite id.
Like this:
<onetomany name="security" lazy="true" proxied="true">
<link to="app.Security" column="id_user"/>
<collection type="array">
<order property="securityToken" order="asc" />
</collection>
</onetomany>
I receive exception saying about unknown property securityToken (same
for any other).
Or I am missing something again, and o2m can not be used with composite
keys / this way?
Thanks!
-Sergiy
--~--~---------~--~----~------------~-------~--~----~
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer
You received this message because you are subscribed to the Google Groups
"transfer-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---