[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1086) Support SpringJPAConfiguration

John Turner (JIRA) noreply at atlassian.com
Wed Sep 10 04:57:04 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31137#action_31137 ] 

John Turner commented on HBX-1086:
----------------------------------

I've looked into this a bit more and the PersistenceUnitManager does not do exactly what I thought it did.  I might follow this up with Spring though.

For the project I am working on, the ideal scenario would be this.

HibernateTools loads all persistence.xml from the classpath and executes hbm2ddl on the specified persistent unit.  If multiple persistent units of the same name exist, the class list, mapping file list etc. could be merged.  I know what you are saying re the connection info but the hibernate tools would be used at build time with no need to connect to database (open to correction here).

At suntime,  spring can inject the datasource into the entitymanagerfactory or PersistenceUnitManager in this case and so no connection information exists in the persistence.xml.  Spring can also inject the dialect etc.

I'm sure some of the specifics would need a bit of work, but the idea is sound.  End result would be that by dropping a jar with a persistence.xml, entity classes etc. into an ear, spring will automatically load the configuration and merge into the persistent unit.

I might not be explaining myself very well but I hope this makes a bit of sense?

> Support SpringJPAConfiguration
> ------------------------------
>
>                 Key: HBX-1086
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1086
>             Project: Hibernate Tools
>          Issue Type: New Feature
>          Components: ant
>    Affects Versions: 3.2.0.GA
>            Reporter: John Turner
>
> I'm working on a module based approach to developing a persistence layer for a web application.
> One of the things I want to be able to do is deploy each module in its own jar file with a corresponding persistence.xml file.  Having done this spring's PersistenceUnitManager detects the persistence.xml files at runtime and merges the persistence configuration files into a single persistence configuration.
> Problem is, at build time, I use hibernate tools and jpa configuration to build drop and create schema ddl.  This just picks up the first persistence.xml on the classpath and uses it to provide the jpa configuration.  I would like to see a SpringJPAConfiguration that operates in the same way as the PersistenceUnitManager.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list