Hi Mark,

 

The problem is that my admin system is updating the data outside of
Transfer. What I normally do is trigger a cache clear on the relevant object
being edited which works fine. However, when updating a set of lookup table
items (with sortorder), I can't find a way to tell Transfer to clear the
lookup table objects so that they are then read in again on the next object
get.

 

Regarding the generated methods for sorting, would I call
sortOneToMany("pages") on the block object being edited to force a reload of
the lookup table to pick up the new sort order?

 

<onetomany name="Pages" lazy="true">

            <link to="blockmanagement.blockcontent" column="lnkIDBlock"/>
             <collection type="array">
                     <order property="sortOrder" order="asc"/>
             </collection>

</onetomany>

 

Is there no way to just tell the lookup table to be cleared from the cache
apart from stopping caching on this relationship?

 

James.

---

James  Allen

E: ja...@jamesallen.name

Blog: http://jamesallen.name

Twitter: @CFJamesAllen (Coldfusion / Web development)

Twitter: @jamesallenuk (General)

Twitter: @JamesAllenVoice (Voiceover)

 

From: transfer-dev@googlegroups.com [mailto:transfer-...@googlegroups.com]
On Behalf Of Mark Mandel
Sent: 10 September 2010 14:42
To: transfer-dev@googlegroups.com
Subject: Re: [transfer-dev] Problem with cache and composite onetomany with
sortorder

 

But if you update an item through Transfer, any collection it is in should
re-sort itself implicitly once it is saved.

Are you not seeing that?

If you need, there is also an explicit generated function for telling a
collection to sort.:
http://docs.transfer-orm.com/wiki/Generated_Methods.cfm

Mark

On Wed, Sep 8, 2010 at 7:34 PM, James Allen <slingsho...@googlemail.com>
wrote:

Hi Mark,

 

I'm not quite sure what you mean. I need to clear the cache so that the sort
order of the lookup table is refreshed whenever this field is modified (i.e.
when the admin system is used to re-order the pages allocated to each
block).

 

At the lowest level I tried looping each item stored in the lookup table
based on both composite id's but that does not clear the lookup table
objects from the cache (blockmanagement.blockcontent).

 

What is the correct way of refreshing the lookup table without simply
turning the cache off for this relationship (which I assume is not the only
answer)?

 

Sorry if I've misunderstood though.

 

James.

 

---

James  Allen

E: ja...@jamesallen.name

Blog: http://jamesallen.name

Twitter: @CFJamesAllen (Coldfusion / Web development)

Twitter: @jamesallenuk (General)

Twitter: @JamesAllenVoice (Voiceover)

 

From: transfer-dev@googlegroups.com [mailto:transfer-...@googlegroups.com]
On Behalf Of Mark Mandel
Sent: 08 September 2010 01:29
To: transfer-dev@googlegroups.com
Subject: Re: [transfer-dev] Problem with cache and composite onetomany with
sortorder

 

Stupid question - why do you need to clear the cache?

If you remove an object from the cache, it will be removed, and any
relationships it is in will be cleared.

So work bottom up, rather than top down.

Mark

On Mon, Sep 6, 2010 at 9:20 PM, James Allen <slingsho...@googlemail.com>
wrote:

Hi guys,

I've having problems working out how to correctly remove a lookup
table from the cache which is constructed using a onetomany
composition but using compositeid's to allow the use of a manytomany
lookup table with a sortorder field.

I'm running Transfer 1.1 final, Railo and MS SQL 2005 on Server 2003.

Here is my transfer.xml showing the objects:

               <package name="blockmanagement">
                       <object name="building" table="tblBuildings"
decorator="model.blockmanagement.building">
                               <id name="id" type="numeric" />
                               <property name="BuildingName" type="string"
column="BuildingName" /
>
                               <property name="smallImage" type="string"
column="SmallImage" />

                               <!-- Link between a building and the blocks
it contains -->
                               <onetomany name="Blocks" proxied="true"
lazy="true">
                                       <link to="blockmanagement.block"
column="lnkIDBuilding"/>

                                       <collection type="array">
                                               <order property="BlockName"
order="asc" />
                                       </collection>
                               </onetomany>
                       </object>

                       <object name="block" table="tblBlocks"
decorator="model.blockmanagement.block">
                               <id name="id" type="numeric" />
                               <property name="blockName" type="string"
column="BlockName" />
                               <property name="buildingID" type="numeric"
column="lnkIDBuilding" /
>
                               <property name="contactEmail" type="string"
column="ContactEmail" /
>

                               <!-- Link between the block and the content
pages it has -->
                               <onetomany name="Pages" lazy="true">
                               <link to="blockmanagement.blockcontent"
column="lnkIDBlock"/>
                               <collection type="array">
                                               <order property="sortOrder"
order="asc"/>
                               </collection>
                               </onetomany>
                       </object>

                       <object name="blockcontent" table="lnkBlock_Content">
                               <compositeid>
                                       <property name="lnkIDBlock"/>
                                       <property name="lnkIDContent"/>
               </compositeid>

                               <property name="lnkIDBlock" type="numeric"
column="lnkIDBlock" />
                               <property name="lnkIDContent" type="numeric"
column="lnkIDContent" />
                               <property name="sortOrder" type="numeric"
column="SortOrder" />

                               <!-- Link between a block and a news item -->
                               <manytoone name="Page" lazy="false">
                                       <link to="content.content"
column="lnkIDContent"/>
                               </manytoone>
                       </object>
               </package>

The only object I'm not showing in the above is the content.content
(pages) object as its not part my issue.

As you'll see from the above, a building can have a number of blocks.
Each block can have a number of content pages. Now these content pages
are composed using a onetomany to the 'blockcontent' object which is
actually a lookup table with the following d/b structure:

lnkIDBlock
lnkIDContent
SortOrder

This object then has a manytoone composition to link the lookup table
to the content pages the block has. I used this method so that I can
handle 'SortOrder' field in the lookup table.

The problem I'm having is that I can't find a way to remove the lookup
table data from the cache. My first thought was that if I simply
remove the block from the cache:

<cfset
getTransfer().discardByClassAndKey(className="blockmanagement.block",key=arg
uments.blockID)>

... that this would be enough to clear the pages lookup table
composition as well?

However, this does not work and the old sortorder is maintained of the
frontend of the site until a full transfer restart.

I then thought that perhaps I need to loop the content of the lookup
table and individually clear each 'blockcontent' object:

<cfset var pages = getBlock(arguments.blockID).getPagesArray()>
<cfset var x = 0>
<cfset var keys = StructNew()>

<cfloop from="1" to="#ArrayLen(pages)#" index="x">
    <cfset keys["lnkIDBlock"] = pages[x].getlnkIDBlock()>
    <cfset keys["lnkIDContent"] = pages[x].getlnkIDContent()>

    <cfset
getTransfer().discardByClassAndKey(className="blockmanagement.blockcontent",
key=keys)>
</cfloop>

However, still no luck with this and the sortorder does not change so
I assume the above code does not remove the blockcontent objects from
the cache?

I have also tried removing the building from the cache as well (as I
retrieve the blocks via the building object) but still no joy.

Sorry for the long post, but would love some insight on this. I'm
obviously doing something wrong but I just can't work out what.

Thanks,
James.

--
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions
-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

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
transfer-dev+unsubscr...@googlegroups.com
<mailto:transfer-dev%2bunsubscr...@googlegroups.com> 
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en




-- 
E: mark.man...@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

cf.Objective(ANZ) - Nov 18, 19 - Melbourne Australia
http://www.cfobjective.com.au

Hands-on ColdFusion ORM Training
www.ColdFusionOrmTraining.com

-- 

Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions
-on-transfer
 
Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
 
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
transfer-dev+unsubscr...@googlegroups.com
<mailto:transfer-dev%2bunsubscr...@googlegroups.com> 
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions
-on-transfer
 
Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
 
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
transfer-dev+unsubscr...@googlegroups.com
<mailto:transfer-dev%2bunsubscr...@googlegroups.com> 
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en




-- 
E: mark.man...@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

cf.Objective(ANZ) - Nov 18, 19 - Melbourne Australia
http://www.cfobjective.com.au

Hands-on ColdFusion ORM Training
www.ColdFusionOrmTraining.com

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions
-on-transfer
 
Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8
 
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
transfer-dev+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/transfer-dev?hl=en

-- 
Before posting questions to the group please read:
http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer

Try out the new Transfer ORM Custom Google Search:
http://www.google.com/cse/home?cx=002375903941309441958:2s7wbd5ocb8

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 
transfer-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en

Reply via email to