The error message that you are having is because you have your properties
wrong in ColdFusion ORM.
<cfproperty name="InvoiceLine" fieldtype="many-to-one"
cfc="lib.model.beans.InvoiceLine">
Should be
<cfproperty name="InvoiceLine" fieldtype="many-to-one" cfc="
InvoiceLine">
Notice how I have removed the path notation to the CFC?
This is because ORM or hibernate uses the table name to do relationships
with the Entities, that means it has no clue or idea what file system paths
you might have and it doesn't care and will complain as you have just found
out.
Entities are representations of what the table holds and the name of the
table, to do a relationship you use that information in the Database and not
the filename of the Entity. This is one thing that keeps trapping people up
when trying to learn relationships in ORM.
Hope that helps.
Regards,
Andrew Scott
http://www.andyscott.id.au/
I'm talking just about adobe CF, but if yo'ure using the CF property
tag, and you have a related object (manytoone, onetomany) specified in
a CFC attribute, you *need* the full path... unless it's in the same
directory. You might get away with it if you do an import statement in
your cfc, ala:
import com.foo.bah.*;
....
property ... cfc="User"....;
where user is in the com.foo.bah package, but in my experience that's flaky.
I *always* fully-qualify the cfc paths. Always.
> --
> You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
> To post to this group, send email to cf-or...@googlegroups.com.
> To unsubscribe from this group, send email to cf-orm-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cf-orm-dev?hl=en.
>
>
The CFCLocation setting in Application.cfc is there so that people can use
certain directory structures for their CFC's rather than ColdBox scan the
entire directory structure of the web application.
It makes no difference if you use it or not, when coming to the CFC
attribute to the Entity property for relationships.
If you need the full path then explain to me why this works?
property name="Comment" fieldtype="many-to-one" CFC="Post"
fkcolumn="Post" lazy="true";
This is actually in a production website at the moment, it doesn't use the
dot notation so the statement that you NEED is not correct.
I did place the dot notation path and it still worked, so that doesn't
appear to be the problem.
But Marc if you are referencing the Entity to use in your code then you
either have to do an import like you did, or use the full path but again you
don't have to use the full path.
Createobject rules apply, basically
Sent from my miniature iPad
On Jun 3, 2011, at 8:51 PM, "Andrew Scott" <and...@andyscott.id.au>
wrote:
When referencing the Entity inside code yes you do need, unless inside that
directory. This doesn't apply to the CFC attribute to the property of an
Entity.
Marc, please take into consideration the differences, and what is being
asked as well.
If it is a mapping I am wondering if that might be the issue, especially
when you removed the path and it works with a different error?
We will probably need to see the relationship of the lib directory to tell
you more. But it is my guess that when you removed the dot notation it was
able to find the Entity, so it seems to make sense.
I personally did not think that a mapping would be the issue, but just to
clear this up some. Yes you don't *NEED* to use the path to the CFC has a
dot notation path, provided it is in the same directory. If it is outside
then yes you do need the dot notation path as everyone is saying.
But I will also ask another question, is the lib directory also used in the
cfclocation? I am taking a stab in the dark here, but if it is not then it
might not be seen as a persistent entity in this case. I was under the
impression that all persistent entities need to be accessible within one of
two locations the entire webroot structure, or what is defined in the
cfclocation.
Regards,
Andrew Scott
http://www.andyscott.id.au/
> --
> You received this message because you are subscribed to the Google Groups
> "cf-orm-dev" group.
> To post to this group, send email to cf-or...@googlegroups.com.
> To unsubscribe from this group, send email to cf-orm-
> dev+uns...@googlegroups.com.
Hi there,
I, too, have found at times that ormReload() is unreliable.
In fact there was a time where I would;
delete all hbmxml files (because we create the mapping files).
clear the template cache
clear the CFC cache
ormReload()
and it often didn't work for us and so I found that I would often
restart the CF Service to get the expected changes.