-->
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: Not inserting rowusing mapping type "text" with cl
PostPosted: Thu Jun 02, 2005 7:55 pm 
Newbie

Joined: Thu Jun 02, 2005 7:32 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.1.2

Mapping documents:
<property
name="sanctionLetterImage"
type="text"
update="true"
insert="true"
column="SANCTION_LETTER_IMG"
/>

Code between sessionFactory.openSession() and session.close():
Session session = null;

try {
//get the HibernateSession object
session = HibernateGatewayFactory.createConnection();
sanctionLetter.setSanctionLetterImage( messageBody );
session.save(sanctionLetter);
session.flush();

}
catch( HibernateException he )
{
throw new FatalException( he );
}
catch( Exception e )
{
throw new FatalException( e );
}
finally
{
HibernateGatewayFactory.closeSession( session );
}


Full stack trace of any exception that occurs:

No Exceptions

Name and version of the database you are using:

Oracle 9i version 9.2.0.3

The generated SQL (show_sql=true):

2005-06-02 19:00:58,774 DEBUG net.sf.hibernate.SQL - select SECTION_LETTER_SEQ.nextval from dual
2005-06-02 19:00:58,794 DEBUG net.sf.hibernate.SQL - insert into SANCTION_LETTER (SANCTION_LETTER_TEMPLATE_ID, SANCTION_
ID, SANCTION_LETTER_DT, SANCTION_LETTER_IMG, CREATE_USER_ID, CREATE_USER_DT, LAST_UPDATE_USER_ID, LAST_UPDATE_DT, SANCTI
ON_LETTER_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.LongType - binding '1' to parameter: 1
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.LongType - binding '901' to parameter: 2
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.TimestampType - binding '02 June 2005 19:00:58' to parameter: 3
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.StringType - binding 'JUNIT Test' to parameter: 4
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.IntegerType - binding '196396' to parameter: 5
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.TimestampType - binding '02 June 2005 19:00:58' to parameter: 6
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.IntegerType - binding '196396' to parameter: 7
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.TimestampType - binding '02 June 2005 19:00:58' to parameter: 8
2005-06-02 19:00:58,804 DEBUG net.sf.hibernate.type.LongType - binding '431' to parameter: 9

Debug level Hibernate log excerpt:


Read from Hibernate In Action page 199 - 200 recommends using the mapping type of 'text' instead of clob so have implemented this in the code and you can see the sql insert statement is output, the code runs thru clean but the row is not persisted to the table. There are no hibernate exceptions thrown either. I've seen the many old posts with other using either the clob mapping type or defining a custom UserType class - but going by the book type="text" seems like the right approach. Does anyone have a working example of using this mapping type? Any ideas would be helpful.


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.