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
As a clearification: I'm also running embedded EJB on top of the microcontainer. I'm a little bit unsure where my problem belongs.