-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Missing Column error when validating against Oracle synonym
PostPosted: Fri Jun 21, 2013 2:14 pm 
Newbie

Joined: Fri Jun 21, 2013 1:59 pm
Posts: 2
This error is supposed to be fixed in 4.2.2.Final (see https://hibernate.atlassian.net/browse/HHH-8226), but I am still getting a Missing Column error when Hibernate tries to validate my schema. Here is my dataSource and sessionFactory defined in Spring (3.2.1):

Code:
  <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass" value="${jdbc.driverClassName}" />
    <property name="jdbcUrl" value="${jdbc.url}" />
    <property name="user" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
    <property name="initialPoolSize" value="${jdbc.initialPoolSize}" />
    <property name="minPoolSize" value="${jdbc.minPoolSize}" />
    <property name="maxPoolSize" value="${jdbc.maxPoolSize}" />
  </bean>

  <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="namingStrategy" ref="namingStrategy" />
    <property name="hibernateProperties">
      <props>
        <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
        <prop key="hibernate.hbm2ddl.auto">validate</prop>
        <prop key="hibernate.synonyms">true</prop>
        <prop key="hibernate.flushMode">AUTO</prop>
      </props>
    </property>
    <property name="packagesToScan" value="com.mycompany.model" />
  </bean>


Here is some log output I'm seeing:

INFO : 06-19-2013 16:14:59 TableMetadata - HHH000261: Table found: myschema.mysynonym
INFO : 06-19-2013 16:14:59 TableMetadata - HHH000037: Columns: []
...
Caused by: org.hibernate.HibernateException: Missing column: serial_number in myschema.mysynonym
at org.hibernate.mapping.Table.validateColumns(Table.java:366)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1284)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:508)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1769)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1840)
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:242)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:372)
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:357)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
... 107 more

It seems that it's unable to find any columns of my synonym based on the output above. My synonym points to a view in another database but I wouldn't think this makes any difference. Can anyone offer up any thoughts on what might be happening?


Top
 Profile  
 
 Post subject: Re: Missing Column error when validating against Oracle synonym
PostPosted: Mon Jun 24, 2013 6:50 pm 
Newbie

Joined: Fri Jun 21, 2013 1:59 pm
Posts: 2
I have had to set hibernate.hbm2ddl.auto=none until I can work around or fix this issue. If someone has any ideas on this please let me know.

Thanks.


Top
 Profile  
 
 Post subject: Re: Missing Column error when validating against Oracle synonym
PostPosted: Wed Jan 29, 2014 3:31 pm 
Newbie

Joined: Wed Jan 29, 2014 3:28 pm
Posts: 1
Were you able to get an answer to this? I'm suffering from the same issue.


Top
 Profile  
 
 Post subject: Re: Missing Column error when validating against Oracle synonym
PostPosted: Mon Feb 03, 2014 5:39 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
All: try updating the Oracle JDBC driver: one of the recent versions had a bug which is now fixed which could lead to this problem.
Sorry I forgot the exact version numbers.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Missing Column error when validating against Oracle synonym
PostPosted: Tue Feb 18, 2014 9:04 am 
Newbie

Joined: Fri Jun 06, 2008 6:14 pm
Posts: 2
I am using the ojdbc7 12.1.0.1 driver (with Oracle 12c). I have hibernate.synonyms set to true. The columns are not returned by the driver to hbm2ddl's validator with that setting alone. If I explicitly pass the connection property ("includeSynonyms=true") to the oracle driver, then the columns are returned as expected and validation completes successfully.

I probably should not need to pass the connection property since that's what hibernate.synonyms is supposed to do, but this is what worked for me.

edit: I forgot to mention I'm using Hibernate 4.2.8.Final


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.