Package javax.jdo

Examples of javax.jdo.PersistenceManager.detachCopy()


    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
   
    try {
      pm.currentTransaction().begin();
      Person detachedParent = (Person) pm.detachCopy(parent);
      assertEquals(parent.getName(), detachedParent.getName());
      assertEquals(parent.getAge(), detachedParent.getAge());
      assertEquals(parent.getAddress().getCity(), detachedParent.getAddress().getCity());
      assertEquals(parent.getAddress().getCountry().getCode(), detachedParent.getAddress().getCountry().getCode());
      assertEquals(parent.getAddress().getCountry().getName(), detachedParent.getAddress().getCountry().getName());
View Full Code Here


    pm.makePersistent(n5);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
   
    try {
      Node detachedN1 = (Node) pm.detachCopy(n1);
      assertEquals(n1.getName(), detachedN1.getName());
      assertEquals(n1.getEdges().size(), detachedN1.getEdges().size());
      logger.log(BasicLevel.DEBUG, "Name can be accessed: " + detachedN1.getName());
      logger.log(BasicLevel.DEBUG, "ToString(): " + detachedN1.toString());
    } catch(Exception e){
View Full Code Here

    pm.makePersistent(n5);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
   
    try {
      Node detachedN1 = (Node) pm.detachCopy(n1);
      assertEquals(n1.getName(), detachedN1.getName());
      assertEquals(n1.getEdges().size(), detachedN1.getEdges().size());
      logger.log(BasicLevel.DEBUG, "Name can be accessed: " + detachedN1.getName());
      logger.log(BasicLevel.DEBUG, "ToString(): " + detachedN1.toString());
    } catch(Exception e){
View Full Code Here

  public Assignment getAssignmentById(long id) {
    PersistenceManager pm = pmf.getPersistenceManager();

    try {
      Assignment assignment = pm.getObjectById(Assignment.class, id);
      return pm.detachCopy(assignment);
    } catch (JDOObjectNotFoundException e) {
      log.log(Level.WARNING, e.getMessage(), e);
      return null;
    } finally {
      pm.close();
View Full Code Here

        log.info("Not attempting to create Picasa albums, since no Picasa AuthSub token was "
            + "found in the config or photo submissions are disabled.");
      }

      assignment = pm.makePersistent(assignment);
      assignment = pm.detachCopy(assignment);
    } finally {
      pm.close();
    }
    return assignment;
  }
View Full Code Here

  @Override
  public Assignment save(Assignment assignment) {
    PersistenceManager pm = pmf.getPersistenceManager();
    try {
      assignment = pm.makePersistent(assignment);
      assignment = pm.detachCopy(assignment);
    } finally {
      pm.close();
    }
    return assignment;
  }
View Full Code Here

        assignment.setDescription(defaultMobileAssignmentDescription);
        assignment.setStatus(Assignment.AssignmentStatus.ACTIVE);
        assignment = pm.makePersistent(assignment);
       
        assignment = pm.makePersistent(assignment);
        assignment = pm.detachCopy(assignment);
        assignmentId = assignment.getId();
       
        newAssignment(assignment, "Mobile Submissions", "");
      }
    } finally {
View Full Code Here

  @Override
  public PhotoSubmission save(PhotoSubmission submission) {
    PersistenceManager pm = pmf.getPersistenceManager();
    try {
      pm.makePersistent(submission);
      submission = pm.detachCopy(submission);
    } finally {
      pm.close();
    }
    return submission;
  }
View Full Code Here

  @Override
  public PhotoEntry save(PhotoEntry photo) {
    PersistenceManager pm = pmf.getPersistenceManager();
    try {
      pm.makePersistent(photo);
      photo = pm.detachCopy(photo);
    } finally {
      pm.close();
    }
    return photo;
  }
View Full Code Here

    try {
      Query query = pm.newQuery(AdminConfig.class);
      List<AdminConfig> adminConfigs = (List<AdminConfig>) query.execute();
      if (adminConfigs.size() > 0) {
        adminConfig = pm.detachCopy(adminConfigs.get(0));
      } else {
        LOG.info("No admin config found in datastore.  Creating a new one.");
        adminConfig = new AdminConfig();
        pm.makePersistent(adminConfig);
        adminConfig = pm.detachCopy(adminConfig);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.