hi,

It's lucky to see this thread.

I have been spent two days struggling with exactly the same problem as
Bryce.

Basically, two problems:
1) why the enhancer complains that BaseObject need to be enhanced even
though it does not declare any fields ?

2)  if I declare BaseObject as PersistenceCapable, the appengine
runtime complains that subclass are "multiple relationships of the
same type" are detected. However such relationships are inevitable
because all model classes extend the base.

And now,
the 2nd problem has been overcomed by the link provided by Max.
Thanks, Max.
However I still desire 1st problem could be addressed.

I just want a class structure like:

// do not have persistent annotation here
abstract class BaseObject {
   // ... some common methods | abstract methods
}

@PersistenceCapable
class A extends BaseObject
class B extends BaseObject
...

On Dec 8, 2:38 pm, bryce cottam <bcot...@gmail.com> wrote:
> Thanks for the link Max.
>
> Having BaseBean be PersistenceCapable isn't really a requirement.
> It'd be nice, 'cause pretty much every bean in my class structure is
> going to have an id field, a getter/setter and the exact same JDO
> annotation metadata on that field.  It'd be nice to just have that
> defined once in a base class.  However, it's no big thing to just
> implement an id field on every class, so I can certainly do without
> BaseBean being persistable.  However, I'm noticing above mentioned
> errors when I make BaseBean a plain-ol class with no persistence
> metadata (i.e. it just implements equals and hashCode) and the
> appengine datanucleus plugin seems to be telling me that BaseBean
> needs to be enhanced.  So, either way I go, I'm running into issues.
> I'd like to try to get to the bottom of why my non-persistable base
> class is being required to have been enhanced.  Perhaps something is
> wrong with my configuration/meta data?  perhaps a bug?
>
> any feedback/suggestions would be great.
> thanks!
> -bryce
>
> On Mon, Dec 7, 2009 at 12:04 PM, Max Ross (Google)
>
> <maxr+appeng...@google.com> wrote:
> > I need to investigate the requirement that BaseBean be PersistenceCapable,
> > but the relationship exception you're getting is most likely the result of a
> > separate bug.  Here's a thread with the workaround:
> >https://groups.google.com/group/google-appengine-java/browse_thread/t...
>
> > Max
>
> > On Mon, Dec 7, 2009 at 1:41 AM, bryce cottam <bcot...@gmail.com> wrote:
>
> >> right, we're certainly on the same page on what should/shouldn't be
> >> persisted.  I have that override on every single class that subclasses
> >> BaseBean.  I would never expect JDO/datanucleus or any other framework
> >> for that matter to "magically" persist a field in a non-peristable
> >> super class.  That's why I override it in every subclass.  Again, I
> >> had it in there as a place holder until GAE supported persisting super
> >> class fields in subclasses.  in the release notes of 1.2.8 of GAE, it
> >> indicates such functionality is available, so I removed my overrides,
> >> made BaseBean persistable and started testing.  Once I saw the error
> >> in my original message, I reverted everything back to a state where
> >> BaseBean is not persistable, and in fact, it is abstract and I removed
> >> the implementation of the "id" field and property getter/setters and
> >> migrated that all down to each subclassing bean.  So, given my code
> >> above, no one should be requiring BaseBean to be persistable or even
> >> enhanced.  Good tip on the point that a plugin may be causing this,
> >> here is the stack trace I posted earlier:
>
> >> Persistent class "Class com.resmark.client.model.BaseBean does not
> >> seem to have been enhanced.  You may want to rerun the enhancer and
> >> check for errors in the output." has no table in the database, but the
> >> operation requires it. Please check the specification of the MetaData
> >> for this class.
> >>       at
> >> org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:375)
> >>       at
> >> org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:674)
> >>       at
> >> org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:694)
> >>       at
> >> com.resmark.server.model.service.BaseDataService.create(BaseDataService.java:227)
> >>       at
> >> com.resmark.server.SetupServiceImpl.updateOrCreate(SetupServiceImpl.java:123)
> >>       at
> >> com.resmark.server.SetupServiceImpl.updateOrCreateActivity(SetupServiceImpl.java:60)
> >>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>       at
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>       at
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>       at java.lang.reflect.Method.invoke(Method.java:597)
> >>       at
> >> com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
> >>       at
> >> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
> >>       at
> >> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:166)
> >>       at
> >> com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
> >>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
> >>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> >>       at
> >> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> >>       at
> >> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
> >>       at
> >> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
> >>       at
> >> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> >>       at
> >> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:121)
> >>       at
> >> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
> >>       at
> >> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
> >>       at
> >> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> >>       at
> >> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> >>       at
> >> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
> >>       at
> >> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> >>       at
> >> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
> >>       at
> >> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> >>       at
> >> com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:352)
> >>       at
> >> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> >>       at org.mortbay.jetty.Server.handle(Server.java:313)
> >>       at
> >> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
> >>       at
> >> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
> >>       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
> >>       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> >>       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
> >>       at
> >> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
> >>       at
> >> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
>
> >> and I guess I glanced over it before, but here's the nested stack trace:
> >> Persistent class "Class com.resmark.client.model.BaseBean does not
> >> seem to have been enhanced.  You may want to rerun the enhancer and
> >> check for errors in the output." has no table in the database, but the
> >> operation requires it. Please check the specification of the MetaData
> >> for this class.
> >> org.datanucleus.store.exceptions.NoTableManagedException: Persistent
> >> class "Class com.resmark.client.model.BaseBean does not seem to have
> >> been enhanced.  You may want to rerun the enhancer and check for
> >> errors in the output." has no table in the database, but the operation
> >> requires it. Please check the specification of the MetaData for this
> >> class.
> >>        at
> >> org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass(DatastoreManager.java:644)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass(DatastoreManager.java:82)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreTable.initializeNonPK(DatastoreTable.java:428)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreTable.buildMapping(DatastoreTable.java:285)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreManager.buildStoreData(DatastoreManager.java:405)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreManager.newStoreData(DatastoreManager.java:363)
> >>        at
> >> org.datanucleus.store.AbstractStoreManager.addClasses(AbstractStoreManager.java:788)
> >>        at
> >> org.datanucleus.store.AbstractStoreManager.addClass(AbstractStoreManager.java:759)
> >>        at
> >> org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass(MappedStoreManager.java:358)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass(DatastoreManager.java:631)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer(DatastoreFieldManager.java:1008)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumer(DatastoreFieldManager.java:998)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreFieldManager.<init>(DatastoreFieldManager.java:133)
> >>        at
> >> org.datanucleus.store.appengine.DatastoreFieldManager.<init>(DatastoreFieldManager.java:167)
> >>        at
> >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess(DatastorePersistenceHandler.java:316)
> >>        at
> >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects(DatastorePersistenceHandler.java:236)
> >>        at
> >> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:225)
> >>        at
> >> org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent(JDOStateManagerImpl.java:3185)
> >>        at
> >> org.datanucleus.state.JDOStateManagerImpl.makePersistent(JDOStateManagerImpl.java:3161)
> >>        at
> >> org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1298)
> >>        at
>
> ...
>
> read more »

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to