Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:10:15+00:00 2026-06-13T06:10:15+00:00

Say I have a Page entity which can have an array of associated Document

  • 0

Say I have a Page entity which can have an array of associated Document entities: a straightforward one-to-many relationship.

<cfcomponent entityName="Page" persistent="true" table="pages">

  <!--- A Page can have many Documents --->
  <cfproperty name="document" fieldType="one-to-many" cfc="Document" fkColumn="pageID" inverse="true">

</cfcomponent>

However, each Document needs to know the path of its file system directory and the value of this property can vary according to context, therefore it is not persistent and needs to be passed in on instantiation.

<cfcomponent entityName="Document" persistent="true" table="documents">

  <!--- This value needs to be set so the document knows its location --->
  <cfproperty name="directoryPath" persistent="false">

  <!--- Many Documents can belong to one Page --->
  <cfproperty name="page" fieldType="many-to-one" cfc="Page" fkColumn="pageID">

  <cffunction name="init" output="false">
    <cfreturn this/>
  </cffunction>

</cfcomponent>

If I were loading the array of documents for the page manually or using a Bean Factory, I could specify the directoryPath variable as an argument passed to the Document init() method. But here, the loading of the documents is done automatically by Hibernate.

Is there a way of passing init arguments to related objects when they are loaded by the ORM?

I know I can loop over the documents once loaded and specify the directory, and perhaps that’s best practice, but passing the value to each on init seems more efficient. Is it possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:10:16+00:00Added an answer on June 13, 2026 at 6:10 am

    Looking through documentation it doesn’t seem that there is a way to do what you ask.

    One thing I would suggest is instead of looping through documents to set the property, you could set a property in Page object and access it from Document.

    So after loading Page you would have something like Page.setDocumentPath(documentPath);.

    then when displaying documents you could have something like document.getPage().getDocumentPath();.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have entities Article, Page and Category. I want entity Article to
I have many to one relation, let's say User has a Company. Company entity
Ok, say I have a page with the url: URL.com/checkout/completed , how can I
Let's say you have a profile page that can only be accessed by the
Say I have this code in my page: <script language=javascript> $(document).ready(function() { $(.test).click(function() {
Lets say we have an average of one page fault every 20,000,000 instructions, a
Lets say you have a fragment of the page which displays the most recent
I have a question concerning multiple similair forms on one page. Lets say you
Say I have a page index.html , how can I detect, using JS or
I have a hierarchical data structure (using Entity beans)like say a Book Class which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.