[coldbox-3.5.3] Can I inject a mapped name to the super.init() call in a VirtualEntityService

How can I reference a mapped value as the entityName to a VirtualEntityService? I have a module with a service and that service uses the entity (model) defined in that same module but just saying init(entityName=“object name” is not working…I get an error suggesting that the service cannot find the entity. I tried using object@module and I think that’s just too wire-boxy. It’s just a string name so I’m assuming that the VES uses that name to compare in wirebox to “find” the entity. My ORM configuration does include “model” and “modules”.

Mike Craig

The exact message is

And what does Account look like? Again as per my other message, more information still stands.

Unclear why that’s relevant but here it is

component persistent=“true” entityname=“Account” table=“accounts” cachename=“account” cacheuse=“read-write” {

property name=“accountid” fieldtype=“id” generator=“native” setter=“false”;
property name=“hostaccountid”;
property name=“sitehostname”;
property name=“hostingserver”;
property name=“sitehostpath”;
property name=“sitesshpath”;
property name=“datasourcename”;
property name=“dbserverid”;
property name=“siteschema”;

function init(){};
boolean function IsNew() {return (Len(getAccountId()) ? True : False);};
}

So, I still can’t find what I might be doing wrong or different. I have been using ContentBox as kind of a model to figure somethings out and I’m both astonished and a little freaked out that I’m doing my orm much the same way Luis did…but ContentBox s so amazingly thought through that this does not mean I’m not missing something.

Since I have one (yes, only one) other orm service class working in the root application, I don’t think it’s how my orm is configured so I think it’s related to modules and paths but I’m not sure in what way.

What other kind of information can I provide to get some focus on this?

Mike

Where is your service code?

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

It becomes relevant because of the error that your claiming to get, you might need to go through the stack trace and go back a step or 2 and see why that is happening. But what it appears to be is that your passing arguments into the account at some point and you init function has no arguments. Which is what I wanted to see.

So the question ow is what line is the stack trace saying that this error is occurring and have a look at what is being passed into the constructor.

Remember that the stack trace is your friend, and tells you where the error is occurring. But what is even more helpful is doing a line debug and tracing through the trace and see at what point it is falling over, the beauty is that because you can see all the variables you can see what is in everything before it fails and you get to see the line that is actually failing and what everything contains.

I can’t stress how important the line debugger actually is in situations like this.

modules/accounts/model/AccountService.cfc (and Account.cfc is in the same place).

Did a little research and I found several accounts (no pun intended) that pointed to CF getting balled up and needing to be reset…so I did that…then suddenly the error seemed to change a bit.

Then, I found old code sitting in the deployed directory that I should have purged so the ORM was trying to map the same code twice in two different locations (that confirmed the ORM cfc locations was working correctly at least).

Than, I found that the ORM event handler setting was just recently set to “coldbox.system.orm.hibernate.WBEventHandler” which would not initialize correctly because we don’t have CFIDE mapped the way it needed.

So, it seems an unfortunate series of circumstances came about to initially mask the problem. ORM is seriously a pain…hope to see the gain soon.

Thanks,
Mike

signature0.jpg

YES,

Definitely! But once it is setup, it is such an awesome joy that I even see pink ponies dancing :slight_smile:

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

signature0.jpg