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: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of Stephen Moretti
Sent: 18 November 2008 10:28
To: [email protected]
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> </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"'> [email protected]
[mailto:[EMAIL PROTECTED] <b>On Behalf Of </b>Stephen =
Moretti<br>
<b>Sent:</b> 18 November 2008 10:28<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> [transfer-dev] Re:<o:p></o:p></span></p>
</div>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal =
style=3D'margin-bottom:12.0pt'><o:p> </o:p></p>
<div>
<p class=3DMsoNormal>2008/11/18 Kevin Roche <<a
href=3D"mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</=
a>><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>
<package name=3D"Price"><br>
<object name=3D"Price"
table=3D"Price"><br>
<id
name=3D"priceId" column=3D"priceId"
type=3D"numeric"/><br>
<property
name=3D"packageId" column=3D"packageId"
type=3D"numeric"<br>
nullable=3D"false" /><br>
<property
name=3D"featureId" column=3D"featureId"
type=3D"numeric"<br>
nullable=3D"true" /><br>
<property
name=3D"periodCovered" column=3D"periodCovered"<br>
type=3D"string" nullable=3D"false" /><br>
<property
name=3D"billingRate" column=3D"billingRate"<br>
type=3D"string" nullable=3D"false" /><br>
<property
name=3D"startDate" column=3D"startDate" =
type=3D"date"<br>
nullable=3D"true" /><br>
<property
name=3D"endDate" column=3D"endDate" =
type=3D"date"<br>
nullable=3D"true" /><br>
<property
name=3D"price" column=3D"price" =
type=3D"numeric"<br>
nullable=3D"false" /><br>
<property
name=3D"isSpecialOffer" =
column=3D"isSpecialOffer"<br>
type=3D"boolean" nullable=3D"false" /><br>
<property
name=3D"isActive" column=3D"isActive" =
type=3D"boolean"<br>
nullable=3D"false" /><br>
</object><br>
</package><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>
<package name=3D"Price"><br>
<object name=3D"Price"
table=3D"Price"><br>
<id
name=3D"priceId" column=3D"priceId"
type=3D"numeric"/><br>
<property
name=3D"packageId" column=3D"packageId"
type=3D"numeric"<br>
nullable=3D"false" /><br>
<property
name=3D"featureId" column=3D"featureId"
type=3D"numeric"<br>
nullable=3D"true" /><br>
<property
name=3D"periodCovered" column=3D"periodCovered"<br>
type=3D"string" nullable=3D"false" /><br>
<property
name=3D"billingRate" column=3D"billingRate"<br>
type=3D"string" nullable=3D"false" /><br>
<property
name=3D"startDate" column=3D"startDate" =
type=3D"date"<br>
nullable=3D"true" /><br>
<property
name=3D"endDate" column=3D"endDate" =
type=3D"date"<br>
nullable=3D"true" /><br>
<property
name=3D"price" column=3D"price" =
type=3D"numeric"<br>
nullable=3D"false" /><br>
<property
name=3D"isSpecialOffer" =
column=3D"isSpecialOffer"<br>
type=3D"boolean" nullable=3D"false" /><br>
<property
name=3D"isActive" column=3D"isActive" =
type=3D"boolean"<br>
nullable=3D"false" /><br>
<br>
<br>
<manytoone
name=3D"Feature"><br>
=
<link to=3D"Feature.Feature" =
column=3D"featureId"
/><br>
=
</manytoone><br>
<manytoone
name=3D"Package"><br>
=
<link to=3D"Package.Package" =
column=3D"packageId"
/><br>
=
</manytoone><br>
<br>
</object><br>
</package><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"true"?<o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><o:p> </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> </o:p></p>
</div>
<div>
<p class=3DMsoNormal>You don't need to specify that the column is =
nullable.
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. <o:p></o:p></p>
</div>
<div>
<p class=3DMsoNormal><o:p> </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> <<<
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> </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 "transfer-dev" group. <br>
To post to this group, send email to [email protected] <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 [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
-~----------~----~----~----~------~----~------~--~---