Search the web
Sign In
New User? Sign Up
metal-dev · MetaL Development
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
setreference for foreign keys in 1-to-1 relationshipship   Message List  
Reply | Forward Message #524 of 553 |
Hello,

I was wondering how can i solve the creation of 2 objects with an 1-
to-1 relationship. Using this example class:

<class>

<name>user</name>

<variable>
<name>profile_id</name>
<class>profile</class>
</variable>

</class>

and...

<class>

<name>profile</name>

<variable>
<name>user_id</name>
<class>user</class>
</variable>

</class>

I've created 2 object factory functions of type createobject, one for
each class of user and profile. But it returns that a missing
argument is missing, which is the profile_id and user_id.

As it sustends 'applications should not access reference variables
directly to manipulate the respective objects. Instead you should
declare and use functions of type setreference and getreference to
assign or retrieve the related objects by storing or de-referencing
the respective OID. '

And:

'Applications should not access reference variables directly to
manipulate the respective objects. Instead you should declare and use
functions of type setreference and getreference to assign or retrieve
the related objects by storing or de-referencing the respective OID.
See the section ahead about defining data objects functions to learn
how to declare and use this type of functions.'

How can i create object user and profile and set references in a form
of 1-to-1 relationship? Like this?

<function>
<name>setprofileid</name>
<type>setreference</type>
<parameters>
<variable>profile_id</variable>
<reference>
<argument>profile</argument>
</reference>
</parameters>
</function>

<function>
<name>setuserid</name>
<type>setreference</type>
<parameters>
<variable>user_id</variable>
<reference>
<argument>user</argument>
</reference>
</parameters>
</function>

Also, should i call these functions before persist the database?

Thanks in advance,

regards,
miguel




Thu Feb 21, 2008 2:32 pm

miguel@...
Send Email Send Email

Forward
Message #524 of 553 |
Expand Messages Author Sort by Date

Hello, I was wondering how can i solve the creation of 2 objects with an 1- to-1 relationship. Using this example class: <class> <name>user</name> <variable> ...
Miguel Oliveira
miguel@...
Send Email
Feb 21, 2008
2:31 pm

Hello, ... Yes, you need to make those variables optional to be allowed to save the object without setting them to a reference object. Since the classes...
Manuel Lemos
mallemos
Offline Send Email
Feb 21, 2008
8:06 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help