Hi Prashant. Inheritance isn't fully supported by the App Engine JDO or JPA
implementations right now.

http://code.google.com/p/datanucleus-appengine/issues/detail?id=25

I ran a test with your models and confirmed that this is exactly what you're
running into. If you make your BlockModule class a concrete class and
include the block_text and block_content properties directly, then your
fetching code should work. Release 1.2.5 added the warning about child
objects in the default fetch group. In my experience, the system still does
the appropriate retrieval despite the warning, but if you don't want to see
the warning at all, you can fetch the child object lazily by calling
getBlockModule() before closing the PersistenceManager.

- Jason

On Sat, Sep 26, 2009 at 11:19 PM, Prashant <[email protected]> wrote:

> Hi,
>
> I wrote an JDO object child relationship (code given below) where I want
> store "subclass objects of an Abstract base class" as child of a Parent
> object keeping field type of the base abstract class only. All the objects
> are getting saved properly; if I fetch a single parent object using
> getObjectById method then child object gets fetched but if try to fetch
> whole list of it (6-7 entities) then child objects do not get fetched. I
> know I am fundamentally wrong somewhere but even after giving it a lot of
> effort I couldn't find what to do to make it work.
>
>
> ============ Parent Object Class ==============
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class Block implements Serializable {
>
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     private Long block_id;
>
>     *...@persistent(defaultFetchGroup = "true")
>     private BlockModule block_module;*
>     ....
>     ....
>
>
>
> ============= Abstract base class & child class ============
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public abstract class *BlockModule *implements Serializable {
>
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     protected Key key;
>
>     public abstract Key getKey();
>
>     public abstract String getTitle(HttpServletRequest req);
>
>     public abstract String getContent(HttpServletRequest req);
> }
>
>
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class BlockTextHTML extends BlockModule{
>
>     @Persistent
>     private String block_title;
>
>     @Persistent
>     private String block_content;
>
>     ....
>     ....
>
>
>
> and getting following warning on console
>
> Sep 27, 2009 5:53:47 AM org.datanucleus.store.appengine.MetaDataValidator
> warn
> WARNING: Meta-data warning for antshpra.Block.block_module: The datastore
> does not support joins and therefore cannot honor requests to place child
> objects in the default fetch group.  The field will be fetched lazily on
> first access.  You can modify this warning by setting the
> datanucleus.appengine.ignorableMetaDataBehavior property in your config.  A
> value of NONE will silence the warning.  A value of ERROR will turn the
> warning into an exception.
>
>
> Someone please tell me where I am wrong and/or what else I should add ....
>
> Thanks.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to