We are using synonyms in Oracle
database. So hibernate.hbm2ddl.auto=validate
is not working. So to solve this I added hibernate.synonyms=true
but with this also it is not working completely. When I search for solution online I got to know I have to add includeSynonyms=true
to JDBC
connection property. My application set up has hibernate-ApplicationContext.xml
file, so I tried to add in hibernateProperties
but no luck.
Error is missing column [column] in table [table]
Could some one suggest where should I add this exactly?
Application details:
DB:Oracle
Server: Tomcat
frameworks: Spring(4.3), Hibernate(5.1.17) (xml and annotation configurations)
<bean abstract="true" id="baseSessionFactory" class="XXX.hibernate.infra.AnnotationSessionFactoryBean">
<property name="physicalNamingStrategy" ref="physicalNamingStrategy"/>
<property name="implicitNamingStrategy" ref="implicitNamingStrategy"/>
<property name="entityInterceptor" ref="bdmsTransactionInterceptor"/>
<property name="hibernateProperties">
<props>
<!-- General hibernate properties - START -->
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.integration.envers.enabled">${hibernate.enable.audit}</prop>
<prop key="hibernate.listeners.envers.autoRegister">${hibernate.enable.audit}</prop>
<prop key="org.hibernate.envers.revision_on_collection_change">${hibernate.enable.audit}</prop>
<prop key="org.hibernate.envers.audit_strategy">org.hibernate.envers.strategy.${bdms.hibernate.strategy}</prop>
<prop key="hibernate.jdbc.fetch_size">${jdbc.fetchSize}</prop>
<prop key="hibernate.jdbc.batch_size">${jdbc.batchSize}</prop>
<prop key="javax.persistence.validation.factory">#{validator}</prop>
<prop key="hibernate.synonyms">true</prop>
<prop key="hibernate.connection.includeSynonyms">true</prop>
<!-- General hibernate properties - END -->
</props>
</property>
<property name="packagesToScan" value="XXX.**.common.model"/>
<property name="hbmFileTemplate" value="queries*.hbm.xml"/>
<property name="mappingResources" ref="mappingResources"/>
</bean>`
DataSource: ${datasource.class.name}= com.mchange.v2.c3p0.ComboPooledDataSource
<bean id="dataSource" class="${datasource.class.name}"
destroy-method="close" p:driverClass="${jdbc.driverClassName}"
p:jdbcUrl="${jdbc.url}" p:user="${jdbc.username}"
p:password="${jdbc.password}" p:initialPoolSize="${datasource.initial-pool-size}" p:maxPoolSize="${datasource.max-pool-size}"
p:acquireRetryAttempts="5" p:acquireRetryDelay="3000"
p:idleConnectionTestPeriod="300"
p:debugUnreturnedConnectionStackTraces="true"
p:maxAdministrativeTaskTime="600"
p:numHelperThreads="5"
p:testConnectionOnCheckout="${test.connection.on.checkout:false}">
</bean>`