Package javax.jdo

Examples of javax.jdo.FetchPlan.addGroup()


        try {
            final Class<?> cls = clsOf(rootOid);
            final Object jdoObjectId = JdoObjectIdSerializer.toJdoObjectId(rootOid);
            final PersistenceManager pm = getPersistenceManager();
            FetchPlan fetchPlan = pm.getFetchPlan();
            fetchPlan.addGroup(FetchGroup.DEFAULT);
            result = pm.getObjectById(cls, jdoObjectId);
        } catch (final RuntimeException e) {

            final List<ExceptionRecognizer> exceptionRecognizers = getPersistenceSession().getServicesInjector().lookupServices(ExceptionRecognizer.class);
            for (ExceptionRecognizer exceptionRecognizer : exceptionRecognizers) {
View Full Code Here


  }
 
  private Collection detachAs(){
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fetchPlan = pm.getFetchPlan();
      fetchPlan.addGroup("AList").removeGroup("default");
    try{
      Query query = pm.newQuery(A.class);
      Collection results = (Collection)query.execute();
      logger.log(BasicLevel.DEBUG, "A:");
      Iterator it = results.iterator();
View Full Code Here

        System.out.println( "Error: " + e);
    }
   
    //detach the book --> "all" fetch group
    //all fields are loaded
    fp.addGroup("all").removeGroup("default");
    Book allBook = (Book) pm.detachCopy(book);
    System.out.println( "With the all fetchgroup:");
    try{
      System.out.println( "Title can be accessed: " + allBook.getTitle());
      System.out.println( "Year can be accessed: " + allBook.getYear());
View Full Code Here

    pm.makePersistent(book);
    pm.currentTransaction().commit();
    //detach the book --> "onlyAuthor" fetch group
    //fields title year and author are loaded
    // fields editor is not loaded
    fp.addGroup("onlyAuthor").removeGroup("default");
    Book onlyAuthorBook = (Book) pm.detachCopy(book);
    System.out.println( "With the onlyAuthor fetchgroup:");
    try{
      System.out.println( "Title can be accessed: " + onlyAuthorBook.getTitle());
      System.out.println( "Year can be accessed: " + onlyAuthorBook.getYear());
View Full Code Here

    }
   
    //detach the book --> "editorName" fetch group
    //fields title, year, editor.name are loaded
    //fields author, editor.address are not loaded
    fp.addGroup("editorName").removeGroup("onlyAuthor");
    Book editorNameBook = (Book) pm.detachCopy(book);
    System.out.println( "With the editorName fetchgroup:");
    try{
      System.out.println( "Title can be accessed: " + editorNameBook.getTitle());
      System.out.println( "Year can be accessed: " + editorNameBook.getYear());
View Full Code Here

    System.out.println( "***************attach/detach*****************");
    PersistenceManager pm = pmf.getPersistenceManager();
    //ignore the following lines: detailed in the following step : step7
      //get the fetch plan of the pm
      FetchPlan fp = pm.getFetchPlan();
      fp.addGroup("all");
    //stop ignoring
    detachObject(pm);
    attachObject(pm);
        pm.close();
  }
View Full Code Here

    Novel novel = new Novel(724, author1, 325, "Am I", style2);
    PocketNovel pocketNovel = new PocketNovel(945, author1, 230, "Why o why", style1, 12);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.addGroup("detail").removeGroup("default");
   
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the dictionnary\n " + dictionnary.toString());
    pm.makePersistent(dictionnary);
    logger.log(BasicLevel.DEBUG, "make persistent the novel\n" + novel.toString());
View Full Code Here

   
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detail").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the thesis\n " + thesis1.toString() + "\n");
    pm.makePersistent(thesis1);
    logger.log(BasicLevel.DEBUG, "make persistent the thesis\n " + thesis2.toString() + "\n");
    pm.makePersistent(thesis2);
View Full Code Here

    parent.setChildren(children);
    PersistenceManager pm = pmf.getPersistenceManager();
    try {
      FetchPlan fp = pm.getFetchPlan();
      fp.clearGroups();
      fp.addGroup("detail").removeGroup("default");
      pm.currentTransaction().begin();
      logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
      pm.makePersistent(parent);
      Object id = pm.getObjectId(parent);
      pm.currentTransaction().commit();
View Full Code Here

    parent.setChildren(children);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detail+children-names").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
    pm.makePersistent(parent);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
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.