2 Replies Latest reply on Jun 1, 2007 7:10 PM by Mathew Blackberry

    Specifying which persistence unit to use for Entity Bean

    Mathew Blackberry Newbie

      How can I specify which persistence unit I would use for an entity bean.

      I have two persistence-units defined in persistence.xml

      unit1 connects to a MySQL database and
      unit2 connects to a MSSql database.

      I want hibernate to create the tables for unit1, but unit2 already has the table created and I have selected validate for the hbm2ddl.auto key.

      How can I tell entityBean1 and 2 to use unit1 and entityBean3 and 4 to use unit2? I am using the @PersistenceContext annotation to get an entity manager from my session bean, but this does not help with creating the tables when my EAR is deployed.

      Thanks
      Mat