Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hello, I'm trying to produce POJOs using reverse engineering in hibernate-tools,
and I have encountered some of the problems that were discussed already in many
forum messages.
At the end I have managed to deal with most of the problems, and now I'm able
to create classes from most of the tables that I'm using in an Oracle database 10g.
But one of the table is giving me the usual problem :
Quote:
BUILD FAILED
/Users/formica/Public/COOLTest/build.xml:138: org.hibernate.cfg.JDBCBinderException: The type java.lang.Object spans multiple columns. Only single column types allowed for single columns.
I think the problem is coming from some fields on that table which are of type BINARY_FLOAT.
I'm using oracle jdbc driver
ojdbc14_g.jar that I have downloaded last week from oracle site.
By the way, when turning on DEBUG in log4j I get quite a lot of messages
of the following kind :
Quote:
[hibernatetool] 16401 [main] DEBUG org.hibernate.cfg.JDBCBinder - Sql type mismatch for Column org.hibernate.mapping.Column(IOV_SINCE) between DB and wanted hibernate type. Sql type set to 2 instead of 3
I tried to look around what the numbers (2, 3 , -5, -7,...) means, but I was not able to find any information...where should I look ?
While I was trying to understand the BINARY_FLOAT issue,
I tried to perform a query on that table using a stand-alone program and I managed to retrieve numbers even if there is a "strange" behaviour when asking for metadata information :
Code:
// Create a Statement
Statement stmt = conn.createStatement ();
ResultSet ecal = stmt.executeQuery ("select c.OBJECT_ID , c.CHANNEL_ID , c.CHAN04 from COOLTEST_F0002_IOVS c where ROWNUM < 10");
ResultSetMetaData rsmd1 = ecal.getMetaData();
while (ecal.next()) {
int ncol = rsmd1.getColumnCount();
for (int i=1;i<=ncol;i++)
System.out.print(rsmd1.getColumnLabel(i) + "= " + ecal.getString(i) + " "+rsmd1.getColumnClassName(i)+" "+rsmd1.getColumnTypeName(i)+" ");
System.out.println();
}
ecal.close();
and the print that I get is:
Quote:
OBJECT_ID= 1 java.math.BigDecimal NUMBER CHANNEL_ID= 365032 java.math.BigDecimal NUMBER CHAN04= 21.704052 null BINARY_FLOAT
OBJECT_ID= 2 java.math.BigDecimal NUMBER CHANNEL_ID= 365032 java.math.BigDecimal NUMBER CHAN04= 21.704052 null BINARY_FLOAT
As you can see the function : getColumnClassName(i) does not return any class for BINARY_FLOAT....
Could this be related to my problem with hibernate tool ?
Do you have any hints on how to solve my problem ?
Below I put my reveng.xml file and versions of hibernate that I'm using.
Thanks in advance,
Andrea
PS: thanks a lot for the wonderful job that you are doing with hibernate !!
Hibernate version:
hibernate 3.0.5
hibernate-tools 3.1 alpha5
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd
" >
<hibernate-reverse-engineering>
<type-mapping>
<sql-type jdbc-type="NUMERIC" precision="1" hibernate-type="boolean" />
<sql-type jdbc-type="BIGINT" hibernate-type="long" />
<!--
<sql-type jdbc-type="BIT" hibernate-type="integer" />
<sql-type jdbc-type="TINYINT" hibernate-type="long" />
<sql-type jdbc-type="BIGINT" hibernate-type="long" />
<sql-type jdbc-type="BOOLEAN" hibernate-type="boolean" />
-->
</type-mapping>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_TAGS" exclude="false"/>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_NODES_SEQ" exclude="false"/>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_NODES" exclude="false"/>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_F0003_IOVS_SEQ" exclude="true"/>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_F0003_IOVS" exclude="false"/>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_F0002_IOVS_SEQ" exclude="false"/>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_F0002_IOVS" exclude="true"/>
<table-filter match-schema="ROTHBERG" match-name="COOLTEST_DB_ATTRIBUTES" />
<table-filter match-schema="ROTHBERG" match-name="CHAM03_TAGS" exclude="true" />
<table-filter match-schema="ROTHBERG" match-name="CHAM03_NODES_SEQ" exclude="true" />
<table-filter match-schema="ROTHBERG" match-name="CHAM03_NODES" exclude="true" />
<table-filter match-schema="ROTHBERG" match-name="ARC_STATEMENT" exclude="true" />
<table-filter match-schema="ROTHBERG" match-name="ARC_SITE" exclude="true" />
<table-filter match-schema="ROTHBERG" match-name="ARC_LOG" exclude="true" />
<table-filter match-schema="ROTHBERG" match-name="ARC_HISTORYPATH" exclude="true" />
<table-filter match-catalog=".*" match-schema=".*" match-name=".*" exclude="true" />
</hibernate-reverse-engineering>
Full stack trace of any exception that occurs:
/Users/formica/Public/COOLTest/build.xml:138: org.hibernate.cfg.JDBCBinderException: The type java.lang.Object spans multiple columns. Only single column types allowed for single columns.
Name and version of the database you are using:
Oracle 10g
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: