hey folks,
i have a working hibernate application running at jboss.
Now i want to add a mapping file at runtime to the applications SessionFactory from another independent jar.
Thought i could use therefore the MBean HibernateFactory method "addMapResource(String mapResource)"..
So the steps i take were,
retrieving the MBean and invoke addMapResource
Code:
String resource=...;
MBeanServer server;
InitialContext iCtx=new InitialContext();
String Hibernate_Factory =
"jboss.jca:service=HibernateFactory";
server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
server.invoke(
new ObjectName(Hibernate_Factory),
"addMapResource",
new Object[] { resource },
new String[] { String.class.getName()});
and getting a new SessionFactoryCode:
SessionFactory sf;
sf = (SessionFactory) ctx.lookup("java:/hibernate/HibernateFactory");
I'm a little bit dizzy what the String mapResource [addMapResource(String mapResource)] should be.
Thought the whole mapping as string and not something like a path.
Running this code gives me no error, but if i'm trying to use the added mapping it fails with "no persister.."
If i invoke addMapResource(String mapResource) from JMX Console, wether the String is emoty or senseless gives me
" Operation completed successfully without a return value."
Can anyone help me with this?
greetings