You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Hugi Thordarson <hu...@karlmenn.is> on 2016/03/26 17:31:10 UTC

Duplicate entity names (different projects, same runtime)

Hi all.
I just stumbled into a problem where two of my cayenne projects have the same entity name (but different DataObject classes, of course) and this is causing conflicts in behaviour, when both projects are running in the same ServerRuntime.

I’m guessing I’m pretty much borked and should rename one of the entities?

Are people using any method for namespacing their entities in Cayenne? In EOF we usually added a prefix to the entity name to avoid stuff like this.

Cheers,
- hugi

Re: Duplicate entity names (different projects, same runtime)

Posted by Andrus Adamchik <an...@objectstyle.org>.
> On Mar 28, 2016, at 8:18 PM, Hugi Thordarson <hu...@karlmenn.is> wrote:
> 
> One question: Can I use periods in the ObjEntity name? I.e. is there anything against me using the fully qualified class name as the entity name?

I've never tried, but I think you can.

A.

Re: Duplicate entity names (different projects, same runtime)

Posted by Hugi Thordarson <hu...@karlmenn.is>.
Thanks Andrus, I suspected this was the case. Fortunately the table names are different, so I’m not hitting the other bugs. But having each datamap live in it’s own namespace would be awesome.

Maybe Cayenne should warn the user when there are two ObjEntities with the same name? Even throw an exception and shut down?

One question: Can I use periods in the ObjEntity name? I.e. is there anything against me using the fully qualified class name as the entity name?

Cheers,
- hugi



> On 28. mar. 2016, at 17:11, Andrus Adamchik <an...@objectstyle.org> wrote:
> 
> Yes, ObjEntity name should be unique in the runtime. Like you said it is easy to fix by renaming. I think we should start using DataMaps for namespacing in Cayenne eventually.
> 
> Hope your *table* names are different though. Here is a real namespacing bug that needs to be addressed:
> 
> https://issues.apache.org/jira/browse/CAY-2036
> https://issues.apache.org/jira/browse/CAY-1152
> 
> Andrus
> 
> 
>> On Mar 26, 2016, at 7:31 PM, Hugi Thordarson <hu...@karlmenn.is> wrote:
>> 
>> Hi all.
>> I just stumbled into a problem where two of my cayenne projects have the same entity name (but different DataObject classes, of course) and this is causing conflicts in behaviour, when both projects are running in the same ServerRuntime.
>> 
>> I’m guessing I’m pretty much borked and should rename one of the entities?
>> 
>> Are people using any method for namespacing their entities in Cayenne? In EOF we usually added a prefix to the entity name to avoid stuff like this.
>> 
>> Cheers,
>> - hugi
> 


Re: Duplicate entity names (different projects, same runtime)

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yes, ObjEntity name should be unique in the runtime. Like you said it is easy to fix by renaming. I think we should start using DataMaps for namespacing in Cayenne eventually.

Hope your *table* names are different though. Here is a real namespacing bug that needs to be addressed:

https://issues.apache.org/jira/browse/CAY-2036
https://issues.apache.org/jira/browse/CAY-1152

Andrus


> On Mar 26, 2016, at 7:31 PM, Hugi Thordarson <hu...@karlmenn.is> wrote:
> 
> Hi all.
> I just stumbled into a problem where two of my cayenne projects have the same entity name (but different DataObject classes, of course) and this is causing conflicts in behaviour, when both projects are running in the same ServerRuntime.
> 
> I’m guessing I’m pretty much borked and should rename one of the entities?
> 
> Are people using any method for namespacing their entities in Cayenne? In EOF we usually added a prefix to the entity name to avoid stuff like this.
> 
> Cheers,
> - hugi