Package org.datanucleus.store.appengine

Examples of org.datanucleus.store.appengine.DatastoreManager$KeyOnlyFieldManager


  public DatastoreEntityManager(EntityManagerFactory emf, PersistenceManagerFactory pmf,
      PersistenceContextType contextType) {
    super(emf, pmf, contextType);
    if (tx != null) {
      DatastoreManager storeMgr = (DatastoreManager) getObjectManager().getStoreManager();
      if (storeMgr.connectionFactoryIsTransactional()) {
        // install our own transaction object
        tx = new DatastoreEntityTransactionImpl(om);
      }
    }
  }
View Full Code Here


    // Need to fetch the fields one at a time instead of using
    // sm.provideFields() because that method doesn't respect the ordering
    // of the field numbers and that ordering is important here.
    for (String projectionField : projectionFields) {
      StateManager currentStateManager = sm;
      DatastoreManager storeMgr = (DatastoreManager) objectManager.getStoreManager();
      ClassLoaderResolver clr = objectManager.getClassLoaderResolver();
      List<String> fieldNames = getTuples(projectionField, alias);
      JavaTypeMapping typeMapping;
      Object curValue = null;
      boolean shouldBeDone = false;
      for (String fieldName : fieldNames) {
        if (shouldBeDone) {
          throw new RuntimeException(
              "Unable to extract field " + projectionField + " from " +
              sm.getClassMetaData().getFullClassName() + ".  This is most likely an App Engine bug.");
        }
        DatastoreTable table = storeMgr.getDatastoreClass(
            currentStateManager.getClassMetaData().getFullClassName(), clr);
        typeMapping = table.getMappingForSimpleFieldName(fieldName);
        if (typeMapping instanceof EmbeddedMapping) {
          // reset the mapping to be the mapping for the next embedded field
          typeMapping = table.getMappingForSimpleFieldName(fieldName);
View Full Code Here

    if (query.getCandidateClass() == null) {
      throw new FatalNucleusUserException(
          "Candidate class could not be found: " + query.getSingleStringQuery());
    }
    DatastoreManager storeMgr = getStoreManager();
    ClassLoaderResolver clr = getClassLoaderResolver();
    AbstractClassMetaData acmd = getMetaDataManager().getMetaDataForClass(query.getCandidateClass(), clr);
    if (acmd == null) {
      throw new FatalNucleusUserException("No meta data for " + query.getCandidateClass().getName()
          + ".  Perhaps you need to run the enhancer on this class?");
    }

    storeMgr.validateMetaDataForClass(acmd, clr);

    DatastoreTable table = storeMgr.getDatastoreClass(acmd.getFullClassName(), clr);
    QueryData qd = validate(compilation, parameters, acmd, table, clr, isJDO);

    if (NucleusLogger.QUERY.isDebugEnabled()) {
      NucleusLogger.QUERY.debug(localiser.msg("021046", "DATASTORE", query.getSingleStringQuery(), null));
    }
View Full Code Here

   * @return The pojo that corresponds to the provided entity.
   */
  public static Object entityToPojo(final Entity entity, final AbstractClassMetaData acmd,
      final ClassLoaderResolver clr, ObjectManager om,
      boolean ignoreCache, final FetchPlan fetchPlan) {
    final DatastoreManager storeMgr = (DatastoreManager) om.getStoreManager();
    storeMgr.validateMetaDataForClass(acmd, clr);
    FieldValues fv = new FieldValues() {
      public void fetchFields(StateManager sm) {
        sm.replaceFields(
            acmd.getPKMemberPositions(),
            new DatastoreFieldManager(sm, storeMgr, entity, DatastoreFieldManager.Operation.READ));
      }
      public void fetchNonLoadedFields(StateManager sm) {
        sm.replaceNonLoadedFields(
            acmd.getPKMemberPositions(),
            new DatastoreFieldManager(sm, storeMgr, entity, DatastoreFieldManager.Operation.READ));
      }
      public FetchPlan getFetchPlanForLoading() {
        return fetchPlan;
      }
    };
    Object pojo = om.findObjectUsingAID(clr.classForName(acmd.getFullClassName()), fv, ignoreCache, true);
    StateManager stateMgr = om.findStateManager(pojo);
    DatastorePersistenceHandler handler = storeMgr.getPersistenceHandler();
    // TODO(maxr): Seems like we should be able to refactor the handler
    // so that we can do a fetch without having to hide the entity in the
    // state manager.
    handler.setAssociatedEntity(stateMgr, EntityUtils.getCurrentTransaction(om), entity);
    int[] fieldsToFetch =
        fetchPlan != null ?
        fetchPlan.getFetchPlanForClass(acmd).getFieldsInActualFetchPlan() : acmd.getAllMemberPositions();
    storeMgr.getPersistenceHandler().fetchObject(
        stateMgr, fieldsToFetch);
    return pojo;
  }
View Full Code Here

TOP

Related Classes of org.datanucleus.store.appengine.DatastoreManager$KeyOnlyFieldManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.