Examples of EntityPKHome


Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

      log.debug("ejbRemove() called, nodeID="+nodeID);
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         home.remove(theKey);
      }
      catch(Exception e)
      {
         log.error("Failed to remove EntityPK", e);
      }
View Full Code Here

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

   public String createEntity()
      throws CreateException
   {
      String msg = null;
      EntityPKHome home = null;
      log.info("Enter createEntity, theKey="+theKey);
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         EntityPK bean = home.findByPrimaryKey(theKey);
         msg = "Found EntityPK, bean="+bean;
         log.info(msg);
      }
      catch(FinderException e)
      {
         EntityPK bean = home.create(theKey.aBoolean, theKey.anInt, theKey.aLong,
            theKey.aDouble, theKey.aString);
         msg = "Created EntityPK, bean="+bean;
         log.info(msg);
      }
      catch(Exception e)
View Full Code Here

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

      int beanCount = 0;
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         EntityPK bean = home.findByPrimaryKey(theKey);
         bean.setOtherField(accessCount);
         log.debug("Set EntityPK.OtherField to: "+accessCount);
         beanCount = bean.getOtherField();
      }
      catch(Exception e)
View Full Code Here

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

      int beanCount = 0;
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         EntityPK bean = home.findByPrimaryKey(theKey);
         beanCount = bean.getOtherField();
         if( beanCount != count )
            throw new RemoteException("BeanCount: " + beanCount + " != " + count);
      }
      catch(RemoteException e)
View Full Code Here

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

      log.debug("ejbRemove() called, nodeID="+nodeID);
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         home.remove(theKey);
      }
      catch(Exception e)
      {
         log.error("Failed to remove EntityPK", e);
      }
View Full Code Here

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

   public String createEntity()
      throws CreateException
   {
      String msg = null;
      EntityPKHome home = null;
      log.info("Enter createEntity, theKey="+theKey);
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         EntityPK bean = home.findByPrimaryKey(theKey);
         msg = "Found EntityPK, bean="+bean;
         log.info(msg);
      }
      catch(FinderException e)
      {
         EntityPK bean = home.create(theKey.aBoolean, theKey.anInt, theKey.aLong,
            theKey.aDouble, theKey.aString);
         msg = "Created EntityPK, bean="+bean;
         log.info(msg);
      }
      catch(Exception e)
View Full Code Here

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

      int beanCount = 0;
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         EntityPK bean = home.findByPrimaryKey(theKey);
         bean.setOtherField(accessCount);
         log.debug("Set EntityPK.OtherField to: "+accessCount);
         beanCount = bean.getOtherField();
      }
      catch(Exception e)
View Full Code Here

Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPKHome

      int beanCount = 0;
      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         EntityPK bean = home.findByPrimaryKey(theKey);
         beanCount = bean.getOtherField();
         if( beanCount != count )
            throw new RemoteException("BeanCount: " + beanCount + " != " + count);
      }
      catch(RemoteException e)
View Full Code Here

Examples of org.jboss.test.testbean.interfaces.EntityPKHome

      getLog().debug("Test Entity Bean PK");
      getLog().debug("====================");
      getLog().debug("");

      getLog().debug(++test+"- "+"Looking up home for nextgen.EntityPK...");
      EntityPKHome pkHome = (EntityPKHome) ctx.lookup("nextgen.EntityPK");
      assertTrue("pkHome != null", pkHome != null);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Calling find on the home...");
      EntityPK pkBean = null;

      // Let's try to find the instance
      try {

         pkBean =  pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100, 1000.0, "Marc"));
      } catch (Exception e) {

         getLog().debug("not found");
         getLog().debug(++test+"- "+"Did not find the instance will create it...");
         pkBean = pkHome.create(true, 10,100, 1000.0, "Marc");
      }


      assertTrue("pkBean != null", pkBean != null);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Retrieving other field...");
      assertTrue("pkBean.getOtherField() == 0", pkBean.getOtherField() == 0);
      getLog().debug(++test+"- "+"Setting it to 4...");
      pkBean.setOtherField(4);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Findind it again ... ") ;

      // Now we should be able to find it
      pkBean = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100,1000.0, "Marc"));

      assertTrue("pkBean != null", pkBean != null);
      getLog().debug("ok");

      // check if the other field has been saved
      getLog().debug(++test+"- "+"Retrieving other field again, should be 4...");
      int newValue = pkBean.getOtherField();
      assertTrue("pkBean.getOtherField() == 4", newValue == 4);
      getLog().debug("4, ok");

      // Get a new EJBObject for this guy
      // Now we should be able to find it
      getLog().debug(++test+"- gettting a new reference ... ") ;
      EntityPK pkBean2 = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100,1000.0, "Marc"));
      assertTrue("findByPrimaryKey AComplexPK", pkBean2 != null);
      getLog().debug("ok");
      getLog().debug(++test+"- Retrieving other field again, should be 4...");
      int newValue2 = pkBean2.getOtherField();
      assertTrue("Retrieving other field again, should be 4...", newValue2 == 4);

      // Now remove it
      getLog().debug(++test+"- "+"Removing the bean...");
      pkBean.remove();
      try
      {
         getLog().debug(++test+"- "+"I should not find it...");
         pkBean = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100, 1000.0, "Marc"));
         assertTrue("findByPrimaryKey should fail", pkBean == null);
      }
      catch (Exception e)
      {
         getLog().debug("not found, OK");
      }

      getLog().debug(++test+"- "+"Call create<METHOD> on EntityPKHome...");
      pkBean = pkHome.createMETHOD(true, 10,100, 1000.0, "Marc");
      getLog().debug(++test+"- "+"Removing the bean...");
      pkBean.remove();
   }
View Full Code Here

Examples of org.jboss.test.testbean.interfaces.EntityPKHome

      getLog().debug("StatelessSession: Now making 1 call on server0 ");
      assertEquals("StatelessSession: Server0 has no calls", 0, slsb.getCallCount());
     
      getLog().debug("Looking up home for nextgen_EntityPK" + getJndiSuffix()+"...");
      EntityPKHome pkHome = (EntityPKHome) ctx.lookup("nextgen_EntityPK" + getJndiSuffix());
      assertTrue("pkHome != null", pkHome != null);
      getLog().debug("ok");

      getLog().debug("Calling find on the home...");
      EntityPK pkBean = null;

      Random rnd = new Random(System.currentTimeMillis());
      int anInt = rnd.nextInt(10);
      int other = rnd.nextInt(10000);
      AComplexPK pk = new AComplexPK(true, anInt, 100, 1000.0, "Marc");
      // Let's try to find the instance
      try
      {
         pkBean =  pkHome.findByPrimaryKey(pk);
      }
      catch (Exception e)
      {
         getLog().debug("Did not find the instance will create it...");
         pkBean = pkHome.create(true, anInt, 100, 1000.0, "Marc");
      }


      assertTrue("pkBean != null", pkBean != null);
      getLog().debug("ok");
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.