You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Chris Gamache <cg...@gmail.com> on 2008/08/08 21:05:36 UTC

more than one ObjEntity mapped to class problem

Well, while we're working on the Cayenne 3.0M4 issue, I'm still experiencing
this problem using Cayenne 2.0 ... I'm having a terrible time trying to
track down this problem. It's most likely in my application code, but I'm
having a devil of a time finding it...

WARNING: com.package.MyClass.doGet [v.2.0.3 May 6 2007] Can't perform
lookup. There is more than one ObjEntity mapped to class
com.package.rdbms.UserTable

This is a tomcat application. When I start the web service, I get these
exceptions when I run a query which returns UserTable...


user = (UserTable) DataObjectUtils.*objectForQuery*(context, select);

How can I find out where Cayenne thinks all the ObjEntities are being loaded
from so I can find the source of the contention.

Also! If I restart the tomcat enough it will eventually start and run, which
makes me think there's a race condition somewhere, and win or loose for one
ObjEntity means the difference between continuing to run and dying.

Please help!

Re: more than one ObjEntity mapped to class problem

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Aug 8, 2008, at 5:17 PM, Chris Gamache wrote:

> On Fri, Aug 8, 2008 at 3:08 PM, Andrus Adamchik <andrus@objectstyle.org 
> >wrote:
>
>> org.apache.cayenne.conf package classes log all startup info. So  
>> that can
>> be used for debugging. Of course if you merge configs by hand,  
>> you'd have to
>> implement your own logging.
>
>
> I guess you're referring to the method I use to load multiple  
> configurations
> at DataContext creation time... :) So, I dropped in a logging  
> facility into
> my ContextCreator to iterator over the ObjEntity collection. There's  
> tons of
> information to choose from. What would be your advice on what to  
> look for?

Loading DataMap events.

Or you can just shoot in the dark, and synchronize your custom config  
loading code; or implement eager loading on app startup (from a filter  
or a listener method) that will be done in a single threaded fashion.

Andrus


Re: more than one ObjEntity mapped to class problem

Posted by Chris Gamache <cg...@gmail.com>.
On Fri, Aug 8, 2008 at 3:08 PM, Andrus Adamchik <an...@objectstyle.org>wrote:

> org.apache.cayenne.conf package classes log all startup info. So that can
> be used for debugging. Of course if you merge configs by hand, you'd have to
> implement your own logging.


I guess you're referring to the method I use to load multiple configurations
at DataContext creation time... :) So, I dropped in a logging facility into
my ContextCreator to iterator over the ObjEntity collection. There's tons of
information to choose from. What would be your advice on what to look for?

Re: more than one ObjEntity mapped to class problem

Posted by Andrus Adamchik <an...@objectstyle.org>.
org.apache.cayenne.conf package classes log all startup info. So that  
can be used for debugging. Of course if you merge configs by hand,  
you'd have to implement your own logging.

Andrus


On Aug 8, 2008, at 3:05 PM, Chris Gamache wrote:

> Well, while we're working on the Cayenne 3.0M4 issue, I'm still  
> experiencing
> this problem using Cayenne 2.0 ... I'm having a terrible time trying  
> to
> track down this problem. It's most likely in my application code,  
> but I'm
> having a devil of a time finding it...
>
> WARNING: com.package.MyClass.doGet [v.2.0.3 May 6 2007] Can't perform
> lookup. There is more than one ObjEntity mapped to class
> com.package.rdbms.UserTable
>
> This is a tomcat application. When I start the web service, I get  
> these
> exceptions when I run a query which returns UserTable...
>
>
> user = (UserTable) DataObjectUtils.*objectForQuery*(context, select);
>
> How can I find out where Cayenne thinks all the ObjEntities are  
> being loaded
> from so I can find the source of the contention.
>
> Also! If I restart the tomcat enough it will eventually start and  
> run, which
> makes me think there's a race condition somewhere, and win or loose  
> for one
> ObjEntity means the difference between continuing to run and dying.
>
> Please help!


RE: more than one ObjEntity mapped to class problem

Posted by Scott Anderson <sa...@airvana.com>.
One really hacky but effective way to do this would be to override the
class loader to log where the classes are coming from - after you filter
for your package of course. You'll be able to mine a full stack trace in
addition to the actual location of the class file.

-----Original Message-----
From: Chris Gamache [mailto:cgamache@gmail.com] 
Sent: Friday, August 08, 2008 3:06 PM
To: user@cayenne.apache.org
Subject: more than one ObjEntity mapped to class problem

Well, while we're working on the Cayenne 3.0M4 issue, I'm still
experiencing
this problem using Cayenne 2.0 ... I'm having a terrible time trying to
track down this problem. It's most likely in my application code, but
I'm
having a devil of a time finding it...

WARNING: com.package.MyClass.doGet [v.2.0.3 May 6 2007] Can't perform
lookup. There is more than one ObjEntity mapped to class
com.package.rdbms.UserTable

This is a tomcat application. When I start the web service, I get these
exceptions when I run a query which returns UserTable...


user = (UserTable) DataObjectUtils.*objectForQuery*(context, select);

How can I find out where Cayenne thinks all the ObjEntities are being
loaded
from so I can find the source of the contention.

Also! If I restart the tomcat enough it will eventually start and run,
which
makes me think there's a race condition somewhere, and win or loose for
one
ObjEntity means the difference between continuing to run and dying.

Please help!