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=arguments.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<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

Reply via email to