amazon-web-servicesamazon-s3jdodatanucleus

Amazon S3, datanucleus, JDO and embedded objects


I have an object with embedded members that I'm making persistent without problems using RDBMS and MySQL.

When I change the datastore to S3 (json plugin) I get the following exception:

Dec 30, 2011 9:50:30 AM org.datanucleus.state.JDOStateManagerImpl isLoaded
WARNING: Exception thrown by StateManager.isLoaded
This constructor is only for objects using application identity.
org.datanucleus.exceptions.NucleusUserException: This constructor is only for objects using application identity.
    at org.datanucleus.state.JDOStateManagerImpl.initialiseForHollowAppId(JDOStateManagerImpl.java:226)
    at org.datanucleus.state.ObjectProviderFactory.newForHollowPopulatedAppId(ObjectProviderFactory.java:119)
    at org.datanucleus.store.json.fieldmanager.FetchFieldManager.getObjectFromJSONObject(FetchFieldManager.java:322)
    at org.datanucleus.store.json.fieldmanager.FetchFieldManager.fetchObjectField(FetchFieldManager.java:250)
    at org.datanucleus.state.AbstractStateManager.replacingObjectField(AbstractStateManager.java:2228)
    at myproject.MyObject.jdoReplaceField(Unknown Source)
    at myproject.MyObject.jdoReplaceFields(Unknown Source)
    at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:1949)
    at org.datanucleus.state.JDOStateManagerImpl.replaceFields(JDOStateManagerImpl.java:1976)
    at org.datanucleus.store.json.JsonPersistenceHandler.fetchObject(JsonPersistenceHandler.java:269)
    at org.datanucleus.state.JDOStateManagerImpl.loadFieldsFromDatastore(JDOStateManagerImpl.java:1652)
    at org.datanucleus.state.JDOStateManagerImpl.loadSpecifiedFields(JDOStateManagerImpl.java:1254)
    at org.datanucleus.state.JDOStateManagerImpl.isLoaded(JDOStateManagerImpl.java:1742)
    at myproject.MyObject.jdoGetmember_(Unknown Source)
    at myproject.MyObject.getMember(Unknown Source)

member_ in myproject.MyObject is defined as:

@Persistent
@Embedded(members = {
...
})
private Member member_;

and

@PersistenceCapable(detachable="true")
@EmbeddedOnly
public class Member implements Serializable {

(no application identity, no key)

The jdoconfig.xml is roughly:

<jdoconfig
  xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
  <persistence-manager-factory name="trans-optional">
    <property name="javax.jdo.PersistenceManagerFactoryClass"
              value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>
    <property name="datanucleus.ConnectionURL"
              value="amazons3:http://s3.amazonaws.com/"/>
    <property name="datanucleus.ConnectionUserName"
              value="..."/>
    <property name="datanucleus.ConnectionPassword"
              value="..."/>
    <property name="datanucleus.cloud.storage.bucket"
              value="mybucket"/>
  </persistence-manager-factory>
</jdoconfig>

I've been to the Supported Features table but I must admit I don't fully understand it.

Does it say that the json plugin does NOT supports embedded objects? Why do my embedded objects need to have application identity? If I define them with application identity I'm also asked to provide a key and I don't want that, I want them to be embedded.

Any help will be much appreciated!


Solution

  • As the Supported Features table says very clearly (to me), there is a CROSS against the JSON datastore column for the feature "Embedded PC", hence it is not supported for that datastore. Obviously if some user/company wanted such a feature they could either

    1. Update the JSON plugin to support it, like was done for the ODF plugin for example
    2. Sponsor that work.

    Alternatively, don't use embedded objects with that datastore.