I have 2 files which need to be bound together: hibernate.cfg.xml and hibernate properties. How can I point them to each other using PropertyPlaceholderConfigurer? Is it possible without declaring them as a beans?(I'm beginner in Spring). Every answer is appreciated.
Thanks in advance.
Nazar
hibernate.cfg.xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="db">
<value>hibernate.properties</value>
</property>
</bean>
<property name="hibernate.dialect">${db.dialect}</property>
<property name="hibernate.connection.driver_class">${db.driver}</property>
<property name="hibernate.connection.url">${db.url}</property>
<property name="hibernate.connection.username">${db.username}</property>
<property name="hibernate.connection.password">${db.password}</property>
<property name="connection.pool_size">${db.pool_size}</property>
<property name="current_session_context_class">${db.current_session_context_class}</property>
<property name="hibernate.show_sql">${db.show_sql}</property>
<property name="hibernate.cache.provider_class">${db.provider_class}</property>
<property name="hibernate.cache.use_second_level_cache">${db.use_second_level_cache}</property>
<property name="hibernate.cache.use_query_cache">${db.use_query_cache}</property>
<property name="hibernate.hbm2ddl.auto">${db.hbm2ddl_auto}</property>
<property name="hibernate.hbm2ddl.import_files">${db.import_files}</property>
<mapping class="com.dataart.mediaportal.model.User"/>
<mapping class="com.dataart.mediaportal.model.Album"/>
<mapping class="com.dataart.mediaportal.model.Role"/>
<mapping class="com.dataart.mediaportal.model.Image"/>
</session-factory>
</hibernate-configuration>
hibernate.properties:
db.username=postgres
db.password=4351
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost/MediaPortalDB
db.pool_size=1
db.dialect=org.hibernate.dialect.PostgreSQLDialect
db.import_files=import.sql
db.hbm2ddl_auto=create
db.use_query_cache=true
db.use_second_level_cache=true
db.provider_class=org.hibernate.cache.HashtableCacheProvider
db.show_sql=true
db.current_session_context_class=thread