1 Reply Latest reply on Jun 1, 2006 4:22 AM by dimitris

    XMBean and a new JDBCAttributePersistenceManager

    carl.carl

      I'm about to write a new persistence manager (JDBCAttributePersistenceManager) for XMBeans in JBoss 3.2.6+ that persists attributes of an XMBean to a database (JDBC).

      The manager shall use a data source (standard JBoss data source) and this should be configured in the conf/jboss-service.xml under the AttributePersistenceManager. My initial problem is how I should be able to securely get a hold of a data source within my PersistenceManager class? Looking it up from the Context, as normally is the case, presents some problems.

      (The actual problem is that I cannot securely get a hold of a data source in my class since the data source has not been bound yet when the AttributePersistenceManager is invoking operations on my manager (i.e. load()). I've tried to make my .sar (a XMBean) be dependent on jboss.jca:service=DataSourceBinding,name=OracleDS but this will only make sure that my XMBean is started after the OracleDS is bound. Operations like load() is called early at JBoss startup. Also, I've tried making the AttributePersistenceManager to be dependent on the same data source, resulting in that JBDCAttributePersistenceManager is not yet started).

      Anyone that can help me?

      Regards
      Carl

        • 1. Re: XMBean and a new JDBCAttributePersistenceManager
          dimitris

          I don't think there is an easy way out. If you want to use the datasource you'll only be able to use it after it is started, and so all your related persistent xmbeans.

          You can have more than one persistence managers active, and override in the xmbean descriptor which one should be contacted.

          Since the dependencies won't work correctly (load() is called very early) you can try to put all your jdbc persisted xmbean in the deploy/deploy.last folder, maybe.