-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: using MBean addMapResource()
PostPosted: Wed Mar 24, 2004 11:46 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
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 SessionFactory

Code:
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 25, 2004 10:12 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Ok, i got it.

After invoke addMapResource(String mapResource), whereby
mapResource is the path of the mapping, you have to invoke start()
of the HibernateFactory MBean!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.