I am trying out lightwire for the first time and I am noticing a small
problem when it comes to returning an array of beans from my DAO. It
seems that its my array is an array of the same exact bean, rather
then multiple instances of my bean.

I have the following in my bean config:

addSingleton("educationService", "educationService");
addSingleton("educationDAO", "educationDAO");
addSingleton("educationGateway", "educationGateway");
addTransient("highschool", "highschoolBean");

addSetterDependency("educationDAO", "highschoolBean");
addConstructorDependency("educationService", "educationGateway");
addConstructorDependency("educationService", "educationDAO");

then in my DAO layer:

 <cffunction name="read" access="public" returntype="any"
output="false" hint="I return a populated an arrray of highschool
objects">
        <cfargument name="ID" type="numeric" required="true" />

        <cfset var q = "" />
        <cfset var objects = arrayNew(1) />

        <cfquery datasource="#getSettings().getDatasource()#"
name="q">
            <!--- some query --->
        </cfquery>
        <!--- populate highschool Beans --->
        <cfloop query="q">
                        <cfset objects[q.currentRow] = getHighschoolBean().init
(q.highschoolID, q.graduationDate, q.highschoolGPA,
q.highschoolClassRank, q.highschoolClassSize, q.highschoolPercentile,
q.dateUpdated) />
        </cfloop>

        <cfreturn objects />
    </cffunction>


Now I do not get an error or anything but if my query return 3
records, lets say Foo high, Woo high, Moo high... then when I call my
code in my cfm template.... loop array... #school.getName()#..... It
will return Moo high 3 times, rather then what it should really be
doing!


Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" 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/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to