A typical part of a persistence.xml looks like
<persistence-unit name="db">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/dbDatasource</jta-data-source>
<properties>
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</persistence-unit>
..
The question I have is, how to dynamic configure a property that is in the given file. So no hardcoded 'hibernate.hbm2ddl.auto' value 'update' but defined in an external properties file.
Thanks in advance.
What do you mean by dynamic? You can replace those at build/package time using Ant or Maven filtering. That is not completely 'dynamic', but will do if you just want different configurations (testing, release, etc.)
HTH
In my current seam application I have an external components.xml (located in jboss/server/default/conf) file to configure the application for a particular environment. By 'dynamic' I mean a similar configuration possibility.
I use jboss-4.2.3-GA and seam 2.1.1-GA
Well JPA looks for persistence.xml on the classpath, to you could probably externalize it, like you did with components.xml. Depending on your application structure, you may run into problems, though.
So if have different environments, a separate build for each one would be the safest thing.
Well, I think u need to create persistence class manuallly as a java class and register it.
Here i found some example, but u need to find it in google how to create persistence provider.