ORM and loading parents attributes

15 views
Skip to first unread message

Seth Johnson

unread,
Jul 11, 2011, 7:06:57 PM7/11/11
to coldfu...@googlegroups.com

I am building a real estate website which has a concept of users, these users can have galleries (collections of properties that meet a certain criteria).   If I want to load a page of public galleries from various users hibernate is also loading all of the users and all of their related user data and it seems quite slow.  Is there a quicker/better way to just get a handle on those particular public galleries and the specific attributes I need to display - like I would with cfquery? 

 

User.cfc

<cfproperty name="MemberID" column="MemberID" type="numeric" ormtype="int" fieldtype="id" generator="native" />

<cfproperty name="FirstName" column="FirstName" type="string" ormtype="string" notempty="true" display="First Name" />

<cfproperty name="LastName" column="LastName" type="string" ormtype="string"  notempty="true" display="Last Name"  />

...

<cfproperty name="Gallery" type="array" fieldtype="one-to-many" cfc="gallery" fkcolumn="memberID" lazy="true">

 

Gallery.cfc

<cfproperty name="name" column="name" type="string" ormtype="string"  />

<cfproperty name="galleryID" column="galleryID" type="numeric" ormtype="int" fieldtype="id" generator="native"  />

<cfproperty name="isPublic" column="isPublic" type="numeric" ormtype="int" default="0" />

<cfproperty name="created" column="created" type="date" ormtype="timestamp"  />    

<cfproperty name="User"  fieldtype="many-to-one" cfc="User"  fkcolumn="memberID" lazy="true">

 

Thanks!

 

Seth

Sean Corfield

unread,
Jul 11, 2011, 9:17:39 PM7/11/11
to coldfu...@googlegroups.com
You might do better asking this on the cf-orm-dev mailing list since
it's about the ORM implementation and not OO design issues...

http://groups.google.com/group/cf-orm-dev

Sean

Seth Johnson

unread,
Jul 11, 2011, 9:29:47 PM7/11/11
to coldfu...@googlegroups.com
Thanks Sean, I am on that list too and posted to the wrong one apparently.  Carry on :)

Seth
--
You received this message because you are subscribed to the Google Groups "Object-Oriented Programming in ColdFusion" group.
To post to this group, send email to coldfu...@googlegroups.com.
To unsubscribe from this group, send email to coldfusionoo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/coldfusionoo?hl=en.

Reply all
Reply to author
Forward
0 new messages