I saw a message regarding this issue in the old Sourceforge forum but I didn't see a resolution. Here is a (partial) hibernate mapping:
Code:
<class name="Column" mutable="false" table="user_tab_cols">
<composite-id>
<key-many-to-one name="table" class="Table" column="table_name"/>
<key-property name="name" column="column_name" type="string" length="30" />
</composite-id>
<property name="dataType" column="data_type" length="106" not-null="false" type="string"/>
<property name="length" column="data_length" not-null="true" type="java.lang.Long"/>
<property name="precision" column="data_precision" not-null="false" type="java.lang.Long"/>
<property name="scale" column="data_scale" not-null="false" type="java.lang.Long"/>
<property name="nullable" column="nullable" length="1" not-null="false" type="string"/>
<property name="defaultValue" column="data_default" not-null="false" type="string"/>
<property name="sequence" column="column_id" not-null="false" type="java.lang.Long"/>
</class>
that fails when calling it like this:
Code:
Query query = session.createQuery("from Column as c where c.table.name = 'ABC'");
List columnList = query.list();
System.out.println(columnList.size());
But works if you do it like this:
Code:
Iterator columns = session.iterate("from Column as c where c.table.name = 'ANALYTES'");
while (columns.hasNext()){
System.out.println(columns.next());
}
I get "java.sql.SQLException: Stream has already been closed". The problem seems to be with the data_default column of type LONG. If I comment it out, the code works either way.