You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Borut Bolčina <bo...@gmail.com> on 2009/06/16 12:03:08 UTC
Two DataMaps/DataNodes with the same entity/class name
Hi,
is it somehow possible to have two DomainNodes (2 different independent
databases) with the same entity/class name? Both databases have table
(entity) "user" and I don't want to rename one class to UserSomething.
Regards,
Borut
Re: Two DataMaps/DataNodes with the same entity/class name
Posted by Borut Bolčina <bo...@gmail.com>.
Yeah, it is usage patterns that I miss in the documentation. Luckily for me,
this list is very responsive! Thanks.
2009/6/16 Andrus Adamchik <an...@objectstyle.org>
> Isn't this a better scenario?
>>
>
>
> It all depends on your app I guess.
>
> Andrus
>
>
>
> On Jun 16, 2009, at 2:05 PM, Borut Bolčina wrote:
>
> OK, I will try to use two different data domains, after all, the databases
>> are completely unrelated. Isn't this a better scenario?
>>
>> -Borut
>>
>> 2009/6/16 Andrus Adamchik <an...@objectstyle.org>
>>
>> You have to place them in different DataDomains and use separate contexts
>>> to access them. Or call your class UserSomething (which looks like a more
>>> sensible way to me to resolve a naming conflict).
>>>
>>> Andrus
>>>
>>>
>>> On Jun 16, 2009, at 1:03 PM, Borut Bolčina wrote:
>>>
>>> Hi,
>>>
>>>>
>>>> is it somehow possible to have two DomainNodes (2 different independent
>>>> databases) with the same entity/class name? Both databases have table
>>>> (entity) "user" and I don't want to rename one class to UserSomething.
>>>>
>>>> Regards,
>>>> Borut
>>>>
>>>>
>>>
>>>
>
Re: Two DataMaps/DataNodes with the same entity/class name
Posted by Andrus Adamchik <an...@objectstyle.org>.
> Isn't this a better scenario?
It all depends on your app I guess.
Andrus
On Jun 16, 2009, at 2:05 PM, Borut Bolčina wrote:
> OK, I will try to use two different data domains, after all, the
> databases
> are completely unrelated. Isn't this a better scenario?
>
> -Borut
>
> 2009/6/16 Andrus Adamchik <an...@objectstyle.org>
>
>> You have to place them in different DataDomains and use separate
>> contexts
>> to access them. Or call your class UserSomething (which looks like
>> a more
>> sensible way to me to resolve a naming conflict).
>>
>> Andrus
>>
>>
>> On Jun 16, 2009, at 1:03 PM, Borut Bolčina wrote:
>>
>> Hi,
>>>
>>> is it somehow possible to have two DomainNodes (2 different
>>> independent
>>> databases) with the same entity/class name? Both databases have
>>> table
>>> (entity) "user" and I don't want to rename one class to
>>> UserSomething.
>>>
>>> Regards,
>>> Borut
>>>
>>
>>
Re: Two DataMaps/DataNodes with the same entity/class name
Posted by Borut Bolčina <bo...@gmail.com>.
OK, I will try to use two different data domains, after all, the databases
are completely unrelated. Isn't this a better scenario?
-Borut
2009/6/16 Andrus Adamchik <an...@objectstyle.org>
> You have to place them in different DataDomains and use separate contexts
> to access them. Or call your class UserSomething (which looks like a more
> sensible way to me to resolve a naming conflict).
>
> Andrus
>
>
> On Jun 16, 2009, at 1:03 PM, Borut Bolčina wrote:
>
> Hi,
>>
>> is it somehow possible to have two DomainNodes (2 different independent
>> databases) with the same entity/class name? Both databases have table
>> (entity) "user" and I don't want to rename one class to UserSomething.
>>
>> Regards,
>> Borut
>>
>
>
Re: Two DataMaps/DataNodes with the same entity/class name
Posted by Andrus Adamchik <an...@objectstyle.org>.
You have to place them in different DataDomains and use separate
contexts to access them. Or call your class UserSomething (which looks
like a more sensible way to me to resolve a naming conflict).
Andrus
On Jun 16, 2009, at 1:03 PM, Borut Bolčina wrote:
> Hi,
>
> is it somehow possible to have two DomainNodes (2 different
> independent
> databases) with the same entity/class name? Both databases have table
> (entity) "user" and I don't want to rename one class to UserSomething.
>
> Regards,
> Borut
Re: Two DataMaps/DataNodes with the same entity/class name
Posted by Michael Gentry <mg...@masslight.net>.
Hi Borut, you may want to look at my copying DataMaps example:
http://cwiki.apache.org/CAY/copying-datamaps.html
It is old (still references "objectstyle" instead of "apache", but
might work fine with minor changes (like changing the package name).
(I haven't tried it on Cayenne 2.x+ yet.)
I was able to use the same classes across different
DataDomains/DataNodes even within the same running application using
this technique. (I had 7 active database connections to development
(x2), testing (x2), acceptance (x2), and production (x1) databases for
a support program to examine application data internals.) The trick
is to create your DataContext passing it the correct
DataDomain/DataNode to use and then all is well. Cayenne handled
everything very smoothly after that -- everything went to the proper
database connection since the DataContext (which was created with the
DataDomain/DataNode to use) does all the queries and the commits.
mrg
On Tue, Jun 16, 2009 at 6:03 AM, Borut Bolčina<bo...@gmail.com> wrote:
> Hi,
>
> is it somehow possible to have two DomainNodes (2 different independent
> databases) with the same entity/class name? Both databases have table
> (entity) "user" and I don't want to rename one class to UserSomething.
>
> Regards,
> Borut
>
RE: Two DataMaps/DataNodes with the same entity/class name
Posted by "Weddle, Anthony" <An...@bluescopesteel.com>.
How about renaming both classes? If they are different databases, I assume that they are different kinds of users. So XxxxUser and YyyyUser seems appropriate. Just "User" would be a bit ambiguous, I think.
Tony
-----Original Message-----
From: Borut Bolčina [mailto:borut.bolcina@gmail.com]
Sent: Tuesday, 16 June 2009 10:03 p.m.
To: List Cayenne User
Subject: Two DataMaps/DataNodes with the same entity/class name
Hi,
is it somehow possible to have two DomainNodes (2 different independent
databases) with the same entity/class name? Both databases have table
(entity) "user" and I don't want to rename one class to UserSomething.
Regards,
Borut
NOTICE - This message and any attached files may contain information that is confidential and intended only for use by the intended recipient. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any dissemination, copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein. If you have received this message in error please notify the sender immediately and delete the message.