-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problems in Hibernate hbm file mapping when in Unix box.
PostPosted: Wed Jan 12, 2005 7:12 am 
Newbie

Joined: Mon Nov 29, 2004 8:15 pm
Posts: 6
Hibernate version:2.0

[b]Mapping documents:

[b]Code between sessionFactory.openSession() and session.close():


Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi,
I am using hibernate between oracle 9i and Websphere server application. My application is running fine when my Websphere application server is installed in Windows box but I am facing issues with the same application running on Websphere server installed in Unix box. The issue is whenever I am trying to insert into any table, hibernate seems to alter the binding sequence and thus, i get sql error.
This is my hbm mapping file:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.kbstar.baproto.bsrc.involvedparty.assessment.UnixTest" table="UnixTest">
<id name="name" column="name" length="32" type="string">
<generator class="uuid.hex"/>
</id>
<version name="version" column="version" type="int"/>
<property name="age" column="age" type="int"/>
<property name="dob" column="dob" type="timestamp"/>
</class>
</hibernate-mapping>

====================================

This is the table structure :

Name Null? Type
----------------------------------------- -------- ----------------------------
NAME NOT NULL VARCHAR2(32)
VERSION NOT NULL NUMBER(10)
AGE NUMBER(10)
DOB DATE

===============================

This is the exception I am getting:

[1/13/05 10:45:33:766 KST] 5f67250d SQL d net.sf.hibernate.SQL insert into UnixTest (age, dob, name, version) values (?, ?, ?, ?)
[1/13/05 10:45:33:766 KST] 5f67250d SystemOut O Hibernate: insert into UnixTest (age, dob, name, version) values (?, ?, ?, ?)
[1/13/05 10:45:33:767 KST] 5f67250d BatcherImpl e net.sf.hibernate.impl.BatcherImpl preparing statement
[1/13/05 10:45:33:767 KST] 5f67250d EntityPersist e net.sf.hibernate.persister.EntityPersister Dehydrating entity: [com.kbstar.baproto.bsrc.involvedparty.assessment.UnixTest#2c91bdd501696892010169bf34cf0002]
[1/13/05 10:45:33:767 KST] 5f67250d IntegerType e net.sf.hibernate.type.IntegerType binding '12' to parameter: 1
[1/13/05 10:45:33:767 KST] 5f67250d TimestampType e net.sf.hibernate.type.TimestampType binding null to parameter: 2
[1/13/05 10:45:33:767 KST] 5f67250d IntegerType e net.sf.hibernate.type.IntegerType binding '0' to parameter: 3
[1/13/05 10:45:33:767 KST] 5f67250d StringType e net.sf.hibernate.type.StringType binding '2c91bdd501696892010169bf34cf0002' to parameter: 4
[1/13/05 10:45:33:772 KST] 5f67250d BatcherImpl e net.sf.hibernate.impl.BatcherImpl done closing: 0 open PreparedStatements, 0 open ResultSets
[1/13/05 10:45:33:773 KST] 5f67250d BatcherImpl e net.sf.hibernate.impl.BatcherImpl closing statement
[1/13/05 10:45:33:773 KST] 5f67250d JDBCException d net.sf.hibernate.util.JDBCExceptionReporter SQL Exception
[1/13/05 10:45:33:786 KST] 5f67250d JDBCException d net.sf.hibernate.util.JDBCExceptionReporter The following exception was logged
java.sql.SQLException: ORA-01722: invalid number


========================
The log also shows the values being passed.


Would highly appreciate any help on this.

Thanks in advance,
Saurabh


Top
 Profile  
 
 Post subject: How does you code look like?
PostPosted: Wed Jan 12, 2005 9:29 am 
Newbie

Joined: Thu Sep 25, 2003 9:25 am
Posts: 15
It would be useful to see the actual java code you use to make the insert. Perhaps something's wrong there? I don't think it's actually Hibernate that tries to alter the binding sequence...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 12, 2005 10:01 am 
Newbie

Joined: Mon Nov 29, 2004 8:15 pm
Posts: 6
Hi,
Thanks for the reply. Below is attached the code from where I call Hibernate's save method:

Session sess = PfSessionFactory.openSession();
Transaction tx = sess.beginTransaction();
UnixTest aUnixTest = new UnixTest();
aUnixTest.setAge(12);
sess.save(aUnixTest);
tx.commit();

I am in real need for the solution.

Thanks in advance for the help,
Regards,
Saurabh


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 12, 2005 11:50 am 
Newbie

Joined: Thu Sep 25, 2003 9:25 am
Posts: 15
That seems very weird, maybe some of the experts here can help you? Hibernate SHOULD take care of the ordering of the bind parameters automatically, but in this case it seems it doesn't...

I saw another post about a similar problem:

http://forum.hibernate.org/viewtopic.php?p=2222030

but unfortunately no solution there either. Good luck, let us know if you find a solution. Maybe you could try adding some extra parameters and see what happens then, just for the debug and testing...


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

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.