1 Reply Latest reply on Dec 12, 2006 9:39 AM by Fredrik Axelsson

    Deploy and access Hibernate MBean in Microcontainer

    Fredrik Axelsson Newbie

      I'm currently writing seam tests, running the Microcontainer. I need to access a Hibernate MBean, from my test.

      If I wasn't running the Microcontainer, I would write something like this:

      try {
      InitialContext ctx = new InitialContext();
      SessionFactory sf = (SessionFactory)
      ctx.lookup("java:/hibernate/FooSessionFactory");
      Session hsess = sf.getCurrentSession();
      Session dynaSess = hsess.getSession(EntityMode.MAP);
      Query qry = dynaSess.createQuery("select foo from bar where fooName=?");
      qry.setParameter(0, new String("name"));
      List result = qry.list();
      return result;


      How do I achieve this running the Microcontainer? How do I deploy the Hibernate service (MBean) and how do I access it from the test?

      Best regards, Fredrik