-->
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.  [ 1 post ] 
Author Message
 Post subject: hibernate - Unsupported SQL type 2005 on many-to-one constra
PostPosted: Sun Feb 12, 2012 4:11 pm 
Newbie

Joined: Sun Feb 12, 2012 4:09 pm
Posts: 1
I am using hibernate framework to be able to use Oracle or Sybase (customer choice). But when we switch the connection to Sybase, I have some issues about many-to-one constraint. First of all, Oracle complained for clob fields which have been defined as "text" in hibernate_hbm.xml and I solved this issue with using binary (ClobTypeDescriptor.STREAM_BINDING) in custom type. For Oracle, everything is normal and works perfect. But when I switch the db server to Sybase, I get the following error when trying to save record(s) on table which have foreign key constraint.

Caused by: java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0SL: Unsupported SQL type 2005.
at com.sybase.jdbc4.jdbc.SybConnection.getAllExceptions(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.handleSQLE(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.sendQuery(Unknown Source)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.sendQuery(Unknown Source)
at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(Unknown Source)
at com.sybase.jdbc4.jdbc.SybPreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
... 47 more

Here is the mapping:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.aykut.test.persistence">
<class name="classA" table="tableA">
<id name="tableA_Id" type="long">
<generator class="native" />
</id>
<property name="someDateColumn" type="timestamp" />
<set name="destinations" table="tableB" cascade="all" lazy="false">
<key column="tableA_Id" />
<one-to-many class="classB" />
</set>
</class>
<class name="classB" table="tableB">
<id name="tableB_Id" type="long">
<generator class="native" />
</id>
<many-to-one name="classA_Data" class="classA" column="tableA_Id" lazy="false" />
<property name="someInfoColumn" length="64" not-null="true" type="string" />
</class>
</hibernate-mapping>

I run some tests and if there is no any relation between these two tables, records can be saved normally.

There is some weirdness to me like, if I create tables with ddl manually and give bigint type to id columns and if I don't use hibernate.hbm2ddl.auto=update property, everything looks normal. Columns created in bigint type and works fine.

if I use hibernate.hbm2ddl.auto=update property, tables created with numeric(19,0) fields for id columns. When this happen, our mapping is thrown above error.

I read some article and I test them but there is no success. Here is my tests.

Adding mapping to not-null="true" <many-to-one name="classA_Data" class="classA" column="tableA_Id" /> row. FAILED

Adding hibernate.max_fetch_depth = 1 to properties. FAILED.

Adding hibernate.jdbc.use_get_generated_keys=true to properties. FAILED.

These all are happens for Sybase side.

I tested both jconnect 6.0(jdbc3) and 7.0 (jdbc4)

I am using hibernate 3.6.1 final. Tested with Oracle11gR2 and Sybase 12.0.5 - 15.0.2 - 15.0.3

Any suggestion please?


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

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.