[JBoss-user] [EJB 3.0] - Re: how to get entitymanager within MBean

2006-03-31 Thread hfarid
I found some answers (after one long night and tons of coffee :-) )
- To declare the dependancy between SAR and PAR within the same ear file
in your jboss-service.xml (within the sar]

  | server
  | mbean code=com.bla.bla.MYService name=bla.bla:service=MYS
  | dependsjboss.j2ee:service=EJB3,module=put your par file 
here/depends
  | /mbean
  | /server
  | 

- To access the entity manager from MBean
First you need to advertise your entity manager factor
in your persistance.xml

  | property name=jboss.entity.manager.jndi.name 
value=java:/EntityManagers/myem/
  | property name=jboss.entity.manager.factory.jndi.name 
value=java:/EntityManagersFactory/myemFac/
  | 

In the service MBean , override startService(). lookup your entity manager 
factory and call createEntityManger to get yourself an instance of the em I 
created EXTENDED em and it worked for me


Why I am doing all of that... here is the problem I am trying to solve (if you 
know better solution, please share it with all of us)
- I have to maintain a graph, the graph vertcies and the edges are persisted in 
the db using EJB3 entity beans
- my clients (lots of concurrent ones), are travesing portions of the graph, 
updating information in the graph
- The first solution was to use optimistic locks (@version) that killed me 
as some portion of the graph was being updated by multiple clients at the same 
time  lots and lots of exceptions

- Second solution. In a ServiceMBean, I instantiated a JGraph, loaded all my 
entities into the JGraph

- my clients can call methods of a SLSB that forward the call to the service 
MBean
- In the MBean I am controlling the locking mechanism using semaphores per 
vertex/Edge


Problems with my solution:
- In cluster deployment, how can I replicate my JGraph information??



View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3934018#3934018

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3934018


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: how to get entitymanager within MBean

2006-03-30 Thread epbernard
you mean EM or EMF.
I don't see the usefulness of managing the EM lifecycle through JMX

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3933903#3933903

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3933903


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user