[jboss-jira] [JBoss JIRA] (AS7-6327) Create JPA service callback for invoking database migration

Anil Arora (JIRA) jira-events at lists.jboss.org
Mon Jan 14 18:29:21 EST 2013


    [ https://issues.jboss.org/browse/AS7-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12745777#comment-12745777 ] 

Anil Arora commented on AS7-6327:
---------------------------------

Almost the simplest solution I can think about is to create a callback similar to the one in the org.jboss.as.jpa.spi.PersistenceProviderAdaptor class.

interface org.jboss.as.jpa.spi.PersistenceProviderAdaptor {
   public void beforeCreateContainerEntityManagerFactory(PersistenceUnitInfo info);
}

The method is invoked before the call to javax.persistence.spi.PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) method.  The PersistentUnitInfo has everything already needed to do whatever.

I tried to make my own PersistnceProviderAdapter, but it didn't work because of some classloader issues.  
                
> Create JPA service callback for invoking database migration
> -----------------------------------------------------------
>
>                 Key: AS7-6327
>                 URL: https://issues.jboss.org/browse/AS7-6327
>             Project: Application Server 7
>          Issue Type: Feature Request
>          Components: JPA / Hibernate
>    Affects Versions: 7.1.3.Final (EAP)
>            Reporter: Anil Arora
>            Assignee: Scott Marlow
>
> Looking for a simple callback/listener mechanism so that we can invoke a database migration script before JPA persistent unit starts up and runs the Hibernate schema validation mechanism.
> Ideally, there would be a property within the persistence.xml that indicates which class to call.  It would also pass in/inject the datasource that is being used for the persistence unit. 
> Essentially, this would solve the lack of migration support in Hibernate itself.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the jboss-jira mailing list