0

My application was running properly when I was configuring Hibernate.cfg.xml without any DataSource. I am deploying my application on Weblogic. But now I have configured it using a Data Source, (both in .cfg as well as Weblogic). Aster this suddenly I have started getting the exception when update on some table is happening. Without the DataSource its working fine.

This was the old config: (works fine)

<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
    <property name="hibernate.connection.username">username</property>
    <property name="hibernate.connection.password">password</property>
    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <property name="org.hibernate.envers.track_entities_changed_in_revision">true</property>

Following is the new config: (throws exception)

<property name="connection.datasource">DataSourceTest</property>
    <property name="jndi.class">weblogic.jndi.WLInitialContextFactory</property>
    <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
    <property name="org.hibernate.envers.track_entities_changed_in_revision">true</property>
    <property name="show_sql">true</property>
    <!-- <property name="hibernate.connection.autocommit">true</property>  -->
    <property name="hibernate.hbm2ddl.auto">update</property>

I have made the similar cofiguration in Weblogic 12.1.3 also

But now its giving the following exception:

2016-07-20 14:45:02 INFO  AbstractBatchImpl:208 - HHH000010: On release of batch it still contained JDBC statements
2016-07-20 14:45:02 WARN  SqlExceptionHelper:144 - SQL Error: 17004, SQLState: 99999
2016-07-20 14:45:02 ERROR SqlExceptionHelper:146 - Invalid column type: 16
org.hibernate.exception.GenericJDBCException: could not update

All the Select and Insert queries are working just fine, but when the update happens, the above error is thrown.

My Lib folder contains the Hibernate Jar, JPA 2.1 jar.

Is it some issue with the configuration I am doing? All my mappings and columns etc seems to be fine. Any help would be appreciated.

4
  • 1
    Can you try changing your dialect to org.hibernate.dialect.Oracle10gDialect. This error is supposed to be thrown by the Boolean type Commented Jul 20, 2016 at 10:22
  • Thanks a lot for the correct answer.. !!! Just after posting this question I changed the Dialect to 10g...and it worked.... Commented Jul 20, 2016 at 10:29
  • @AlexanderPetrov : Could you explain what you meant by Boolean type error . I am not finding any such clue. How is this exception related to the Dialect ? Commented Jul 20, 2016 at 10:32
  • 1
    Yes it is a conversion problem. In Oracle there is no boolean notation , so you need to tell your driver how to map from java Boolean to the Oracle boolean which just happens to be Char(1) or Number(1) Commented Jul 20, 2016 at 10:36

1 Answer 1

1

Hello the problem is coming from the fact that support of boolean in Oracle is either CHAR(1) or alternatively NUMBER(1). Which basically means that you will either have '1'-'0' or 'Y' -'N' combinations respectively. The problem is a conversion problem the JDBC driver needs to know how to convert your boolean into the CHAR(1)/NUMBER(1)

You can try the following: 1. Set your dialect to org.hibernate.dialect.Oracle10gDialect

Alternatively you can try to convert the Number(1)/Char(1):

@org.hibernate.annotations.Type(type="true_false") @NotNull boolean value;

or

@org.hibernate.annotations.Type(type="yes_no") @NotNull boolean value;

Sign up to request clarification or add additional context in comments.

1 Comment

:Isn't OracleDialect a generic version of Oracle10gDialect? Is it that the 10g dialect acts differently which is causing this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.