Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8036

create EntityManager error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • No Release
    • None
    • None
    • None

    Description

      create a new persistence unit programmatically and map it to a new datasource without redeploy or server restart.
      We tried the following in a stateless session bean:

      Map configOverrides = new HashMap();
      EntityManagerFacotry emf = Persistence.createEntityManagerFactory("unit1", configOverrides);

      But got exception:

      javax.persistence.PersistenceException: [PersistenceUnit: unit1] Unable to build EntityManagerFactory

      <persistence-unit name="unit1">
      <jta-data-source>java:/dataSource1</jta-data-source>

      <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
      <property name="hibernate.show_sql" value="false"/>
      </properties>
      </persistence-unit>

      08:17:58,204 ERROR [STDERR] javax.persistence.PersistenceException: [PersistenceUnit: defaultDataSource] Unable to build EntityManagerFactory
      08:17:58,205 ERROR [STDERR] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
      08:17:58,205 ERROR [STDERR] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
      08:17:58,205 ERROR [STDERR] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)

      Attachments

        Activity

          People

            Unassigned Unassigned
            javatwo_jira Dave Chen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: