This is a multipart message in MIME format.

------=_NextPart_000_03B3_01C9496F.904B20D0
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: 7bit

Thanks Stephen

 

From: transfer-dev@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Stephen Moretti
Sent: 18 November 2008 10:28
To: transfer-dev@googlegroups.com
Subject: [transfer-dev] Re:

 

 

2008/11/18 Kevin Roche <[EMAIL PROTECTED]>


Hi,

I want to check how a table column that supports a relationship should be
defined.

I have the following in my transfer XML file.

<package name="Price">
       <object name="Price" table="Price">
               <id name="priceId" column="priceId" type="numeric"/>
               <property name="packageId" column="packageId" type="numeric"
nullable="false" />
               <property name="featureId" column="featureId" type="numeric"
nullable="true" />
               <property name="periodCovered" column="periodCovered"
type="string" nullable="false" />
               <property name="billingRate" column="billingRate"
type="string" nullable="false" />
               <property name="startDate" column="startDate" type="date"
nullable="true" />
               <property name="endDate" column="endDate" type="date"
nullable="true" />
               <property name="price" column="price" type="numeric"
nullable="false" />
               <property name="isSpecialOffer" column="isSpecialOffer"
type="boolean" nullable="false" />
               <property name="isActive" column="isActive" type="boolean"
nullable="false" />
       </object>
</package>

In fact packageId and FeatureId are both foreign key fields so I propose to
add two many to one entries:

<package name="Price">
       <object name="Price" table="Price">
               <id name="priceId" column="priceId" type="numeric"/>
               <property name="packageId" column="packageId" type="numeric"
nullable="false" />
               <property name="featureId" column="featureId" type="numeric"
nullable="true" />
               <property name="periodCovered" column="periodCovered"
type="string" nullable="false" />
               <property name="billingRate" column="billingRate"
type="string" nullable="false" />
               <property name="startDate" column="startDate" type="date"
nullable="true" />
               <property name="endDate" column="endDate" type="date"
nullable="true" />
               <property name="price" column="price" type="numeric"
nullable="false" />
               <property name="isSpecialOffer" column="isSpecialOffer"
type="boolean" nullable="false" />
               <property name="isActive" column="isActive" type="boolean"
nullable="false" />


               <manytoone name="Feature">
                       <link to="Feature.Feature" column="featureId" />
               </manytoone>
               <manytoone name="Package">
                       <link to="Package.Package" column="packageId" />
               </manytoone>

       </object>
</package>

Should the property tags be removed at the same time? If so how do I specify
that the featureId is optional since there seems not to be an equivalent to
nullable="true"?

 

Yes you need to remove the property for your foreign key. 

 

You don't need to specify that the column is nullable.  You simply don't add
a child object for feature and/or package.

When you pull the saved record from cache/database you will need to check to
make sure that your price object hasFeature or hasPackage before you do a
getFeature or getPackage, otherwise it will throw an error. 

 

http://docs.transfer-orm.com/wiki/Generated_Methods.cfm#ManyToOne_Element
<<<  A page that's open constantly for me - I really need to sort out neat
printout cheat sheet...

 

Stephen




------=_NextPart_000_03B3_01C9496F.904B20D0
Content-Type: text/html;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml"; =
xmlns=3D"http://www.w3.org/TR/REC-html40";>

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-GB link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks Stephen<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0cm 0cm 0cm'>

<p class=3DMsoNormal><b><span lang=3DEN-US =
style=3D'font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=3DEN-US =
style=3D'font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> transfer-dev@googlegroups.com
[mailto:[EMAIL PROTECTED] <b>On Behalf Of </b>Stephen =
Moretti<br>
<b>Sent:</b> 18 November 2008 10:28<br>
<b>To:</b> transfer-dev@googlegroups.com<br>
<b>Subject:</b> [transfer-dev] Re:<o:p></o:p></span></p>

</div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p>

<div>

<p class=3DMsoNormal>2008/11/18 Kevin Roche &lt;<a
href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</=
a>&gt;<o:p></o:p></p>

<p class=3DMsoNormal><br>
Hi,<br>
<br>
I want to check how a table column that supports a relationship should =
be<br>
defined.<br>
<br>
I have the following in my transfer XML file.<br>
<br>
&lt;package name=3D&quot;Price&quot;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;object name=3D&quot;Price&quot;
table=3D&quot;Price&quot;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;id
name=3D&quot;priceId&quot; column=3D&quot;priceId&quot;
type=3D&quot;numeric&quot;/&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;packageId&quot; column=3D&quot;packageId&quot;
type=3D&quot;numeric&quot;<br>
nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;featureId&quot; column=3D&quot;featureId&quot;
type=3D&quot;numeric&quot;<br>
nullable=3D&quot;true&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;periodCovered&quot; column=3D&quot;periodCovered&quot;<br>
type=3D&quot;string&quot; nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;billingRate&quot; column=3D&quot;billingRate&quot;<br>
type=3D&quot;string&quot; nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;startDate&quot; column=3D&quot;startDate&quot; =
type=3D&quot;date&quot;<br>
nullable=3D&quot;true&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;endDate&quot; column=3D&quot;endDate&quot; =
type=3D&quot;date&quot;<br>
nullable=3D&quot;true&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;price&quot; column=3D&quot;price&quot; =
type=3D&quot;numeric&quot;<br>
nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;isSpecialOffer&quot; =
column=3D&quot;isSpecialOffer&quot;<br>
type=3D&quot;boolean&quot; nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;isActive&quot; column=3D&quot;isActive&quot; =
type=3D&quot;boolean&quot;<br>
nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;/object&gt;<br>
&lt;/package&gt;<br>
<br>
In fact packageId and FeatureId are both foreign key fields so I propose =
to<br>
add two many to one entries:<br>
<br>
&lt;package name=3D&quot;Price&quot;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;object name=3D&quot;Price&quot;
table=3D&quot;Price&quot;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;id
name=3D&quot;priceId&quot; column=3D&quot;priceId&quot;
type=3D&quot;numeric&quot;/&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;packageId&quot; column=3D&quot;packageId&quot;
type=3D&quot;numeric&quot;<br>
nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;featureId&quot; column=3D&quot;featureId&quot;
type=3D&quot;numeric&quot;<br>
nullable=3D&quot;true&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;periodCovered&quot; column=3D&quot;periodCovered&quot;<br>
type=3D&quot;string&quot; nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;billingRate&quot; column=3D&quot;billingRate&quot;<br>
type=3D&quot;string&quot; nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;startDate&quot; column=3D&quot;startDate&quot; =
type=3D&quot;date&quot;<br>
nullable=3D&quot;true&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;endDate&quot; column=3D&quot;endDate&quot; =
type=3D&quot;date&quot;<br>
nullable=3D&quot;true&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;price&quot; column=3D&quot;price&quot; =
type=3D&quot;numeric&quot;<br>
nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;isSpecialOffer&quot; =
column=3D&quot;isSpecialOffer&quot;<br>
type=3D&quot;boolean&quot; nullable=3D&quot;false&quot; /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;property
name=3D&quot;isActive&quot; column=3D&quot;isActive&quot; =
type=3D&quot;boolean&quot;<br>
nullable=3D&quot;false&quot; /&gt;<br>
<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;manytoone
name=3D&quot;Feature&quot;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;
&nbsp;&lt;link to=3D&quot;Feature.Feature&quot; =
column=3D&quot;featureId&quot;
/&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;&lt;/manytoone&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;manytoone
name=3D&quot;Package&quot;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;
&nbsp;&lt;link to=3D&quot;Package.Package&quot; =
column=3D&quot;packageId&quot;
/&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;&lt;/manytoone&gt;<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp;&lt;/object&gt;<br>
&lt;/package&gt;<br>
<br>
Should the property tags be removed at the same time? If so how do I =
specify<br>
that the featureId is optional since there seems not to be an equivalent =
to<br>
nullable=3D&quot;true&quot;?<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<p class=3DMsoNormal>Yes you need to remove the property for your =
foreign key. <o:p></o:p></p>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>You don't need to specify that the column is =
nullable.
&nbsp;You simply don't add a child object for feature and/or =
package.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>When you pull the saved record from cache/database =
you will
need to check to make sure that your price object hasFeature or =
hasPackage
before you do a getFeature or getPackage, otherwise it will throw an
error.&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal><a
href=3D"http://docs.transfer-orm.com/wiki/Generated_Methods.cfm#ManyToOne=
_Element">http://docs.transfer-orm.com/wiki/Generated_Methods.cfm#ManyToO=
ne_Element</a>&nbsp;&nbsp;&lt;&lt;&lt;
&nbsp;A page that's open constantly for me - I really need to sort out =
neat
printout cheat sheet...<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>Stephen<o:p></o:p></p>

</div>

<p class=3DMsoNormal><br>
--~--~---------~--~----~------------~-------~--~----~<br>
Before posting questions to the group please read: <br>
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-qu... =
<o:p></o:p></p>

<p style=3D'margin-bottom:12.0pt'>You received this message because you =
are
subscribed to the Google Groups &quot;transfer-dev&quot; group. <br>
To post to this group, send email to transfer-dev@googlegroups.com <br>
To unsubscribe from this group, send email to
[EMAIL PROTECTED] <br>
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=3Den<br>
-~----------~----~----~----~------~----~------~--~---<o:p></o:p></p>

</div>

</body>

</html>

------=_NextPart_000_03B3_01C9496F.904B20D0--


--~--~---------~--~----~------------~-------~--~----~
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 transfer-dev@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to