Re: multiple model usage example
Re: multiple model usage example
- Subject: Re: multiple model usage example
- From: "Joe Little" <email@hidden>
- Date: Mon, 28 Jul 2008 11:18:26 -0700
On Mon, Jul 28, 2008 at 11:03 AM, Kieran Kelleher <email@hidden> wrote:
> Hi Joe,
>
> AFAIK, if you just define properties below for each model using the syntax
> <modelname>.URL, <modelname>.DBUser, etc., all the models and their entities
> will be automatically loaded at startup by Wonder which checks for such
> properties at startup.
>
> In your Application constructor, after super(), all the models and entities
> will have been loaded by Wonder, so you can iterate thru models and/or
> entities and do what you like with them, for example ......
>
> // Make demography eomodel readonly
> boolean demographyIsReadOnly =
> ERXProperties.booleanForKeyWithDefault("demography.isReadOnlyEntities",
> false);
>
> if (demographyIsReadOnly) {
>
> EOModel demography =
> EOModelGroup.defaultGroup().modelNamed("demography");
>
> for (java.util.Enumeration demographyEntityEnumerator =
> demography.entities().objectEnumerator(); demographyEntityEnumerator
> .hasMoreElements();) {
> EOEntity entity = (EOEntity)
> demographyEntityEnumerator.nextElement();
> entity.setReadOnly(true);
> }
>
> }
So, I presume you'd want ERXModelGroup there. The above was not in
Application.java I presume. When asking for a objects for a specific
entity, has done one use the usual utilities to call on the specific
model?
ie.. NSArray items = EOUtilities.objectsForEntityNamed (new
EOEditingContext(), "Item");
I guess I'm only missing the link between auto-loaded models and the
above style call, which I did with this:
admitModel = ERXModelGroup.defaultGroup().modelNamed("admit");
admitArchModel = ERXModelGroup.defaultGroup().modelNamed("admitarch");
Does it just look for an Item across both models?
>
> Kieran
>
> On Jul 28, 2008, at 1:38 PM, Joe Little wrote:
>
>> On Mon, Jul 28, 2008 at 5:08 AM, Kieran Kelleher <email@hidden>
>> wrote:
>>>
>>> Hi Joe,
>>>
>>> Not sure if this is what you are looking for .... here is an example of
>>> entries in Properties for access to different databases:
>>>
>>> <snip>
>>> #########################################################################
>>> # ERExtensions - ERXModelGroup properties
>>> #########################################################################
>>>
>>> er.extensions.ERXModelGroup.prototypeModelNames=WKPrototypes
>>>
>>> cheetah.URL = jdbc:mysql://host1/cheetah?capitalizeTypenames=true
>>> cheetah.DBUser = @@cheetah.dbuser@@
>>> cheetah.DBPassword = @@cheetah.dbpassword@@
>>> cheetah.DBDriver =
>>> cheetah.DBPlugin =
>>> cheetah.DBJDBCInfo =
>>>
>>>
>>> demography.URL = jdbc:mysql://host2/demography?capitalizeTypenames=true
>>> demography.DBUser = @@demography.dbuser@@
>>> demography.DBPassword = @@demography.dbpassword@@
>>> demography.DBDriver =
>>> demography.DBPlugin =
>>> demography.DBJDBCInfo =
>>> </snip>
>>>
>>> IIRC, ERXModelGroup is where a lot of model startup entity loading
>>> munging
>>> happens, so examining the source there can indicate what is happening,
>>> how
>>> it works, and what Properties entries affect what.
>>>
>>
>> I'll look into the code. Never looked inside Wonder source and was
>> hoping for examples on how to use it. So, there isn't posted anyway
>> examples on using ERXModelGroup and loading models into an app within
>> Application? Again, I've been limited to the stuff that WO just gives
>> you to date, which is all automatic. My understanding currently ends
>> there.
>>
>>
>>> HTH,
>>>
>>> Kieran
>>>
>>> On Jul 28, 2008, at 2:22 AM, Joe Little wrote:
>>>
>>>> That would need to be an ER Model I take it. Again, do you happen to
>>>> have a snippet of code taking multiple entity modeler defined models,
>>>> overriding those settings, etc, and then having a joined model group..
>>>> or should this not be in a model group. I'm confused as to how this is
>>>> all done w/ Wonder as I've also been trying to use ModelConnector and
>>>> other PracticalWO Frameworks solutions to the same.
>>>>
>>>>
>>>> On Sun, Jul 27, 2008 at 10:48 PM, Guido Neitzer <email@hidden>
>>>> wrote:
>>>>>
>>>>> On 27.07.2008, at 23:28, Joe Little wrote:
>>>>>
>>>>>> Ok. I've banged my head on this one a lot. ConfigurationManager allows
>>>>>> you to change anything except for the database itself.
>>>>>
>>>>> ??
>>>>>
>>>>> dbConnectURLGLOBAL=jdbc:postgresql://localhost/meetings
>>>>>
>>>>> That can also be set on a per model base.
>>>>>
>>>>> cug
>>>>>
>>>>> --
>>>>> http://www.event-s.net
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>>
>>>>
>>>> This email sent to email@hidden
>>>
>>>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden