[jboss-user] [Microcontainer] - Deploy and access Hibernate MBean in Microcontainer

apamossberg do-not-reply at jboss.com
Tue Dec 12 08:45:48 EST 2006


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
      

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993069#3993069

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993069



More information about the jboss-user mailing list