Ahmad.Masood
Ahmad.Masood

Reputation: 1309

Using a reserved word in @Formula annotation

I want to cast a string column to Integer.

    @Formula("CAST(pContactNumber as UNSIGNED)")
    private Integer contactNumber;

But Hibernate treats UNSIGNED word as account0_.UNSIGNED. Any suggestion how to prevent this.

I have gone through following answer. Hibernate @formula is not supportinng Cast() as int for teradata database

But can someone explain where you use this extended Oracle10gDialect in spring configuration.

Upvotes: 0

Views: 273

Answers (1)

v.ladynev
v.ladynev

Reputation: 19956

hibernate.dialect can be set using the hibernateProperties property of LocalSessionFactoryBean

  <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
    <property name="hibernateProperties">
      <props>
        <prop key="hibernate.dialect">com.example.CustomOracle10gDialect</prop>
      </props>
    </property>
  </bean>

It is for Hibernate 5, because using the package org.springframework.orm.hibernate5.LocalSessionFactoryBean, for Hibernate 4 you need to use org.springframework.orm.hibernate4.LocalSessionFactoryBean.

Upvotes: 1

Related Questions