Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.17
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using: Microsoft SQL Server 2000
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hi,
My environment is Eclipse, Jboss 3.2.3 and MS SQL Server 2000 database. The Hibernate (hibernate.cfg.xml) is using a datasource which is using Microsoft SQL Server JDBC Driver.
I have a table wf_system_option_paaz
CREATE TABLE [dbo].[wf_system_option_paaz] (
[paazpk] smallint NOT NULL ,
[section_name] varchar(50) NULL ,
[keyword_value] varchar(50) NULL ,
[option_value] varchar(100) NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[wf_system_option_paaz] WITH NOCHECK ADD
CONSTRAINT [XPKwf_system_option_paaz] PRIMARY KEY CLUSTERED
(
[paazpk]
) ON [PRIMARY]
GO
I have a screen (JSP) based on this table. User make changes to one row of the table and save them. The Update statement was :
update wf_system_option_paaz set section_name='TA', keyword_value='TSLOCKHOURS', option_value='0'
where paazpk='7'
Everything works ok.
Now I change hibernate.cfg.xml to use a datasource which is based on a ODBC connection and uses ODBC-JDBC Driver.
I perform the same operation; the update statement was same but in the table the varchar data now has been right padded upto its length with empty string. So for example the value of section_name column for this row is 'TA ' instead of 'TA'.
Any reason why this happening and how can I fix it? I have to support ODBC-JDBC Driver.
Thanks
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.loader.Loader] total objects hydrated: 1
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] resolving associations for [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] done materializing entity [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] initializing non-lazy collections
2005-05-04 11:08:06,880 INFO [STDOUT] ConfigurationManager.java: updateSystemOption(): aSystemOption.getOptionValue()[before]=0
2005-05-04 11:08:06,880 INFO [STDOUT] ConfigurationManager.java: updateSystemOption(): aSystemOption.getOptionValue()[after]=-5
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] saveOrUpdate() persistent instance
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] loading [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] attempting to resolve [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] resolved object in session cache [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,880 INFO [STDOUT] ConfigurationManager.java: updateSystemOption(): bSystemOption.getOptionValue()[after save]=-5
2005-05-04 11:08:06,880 INFO [STDOUT] commitTransaction(): Committing database transaction of this thread (starting)
2005-05-04 11:08:06,880 INFO [STDOUT] commitTransaction(): Committing database transaction of this thread.
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.transaction.JTATransaction] commit
2005-05-04 11:08:06,880 DEBUG [net.sf.hibernate.impl.SessionImpl] flushing session
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.SessionImpl] Flushing entities and processing referenced collections
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.persister.AbstractEntityPersister] com.pendylum.main.model.SystemOption.optionValue is dirty
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.SessionImpl] Updating entity: [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.SessionImpl] Processing unreferenced collections
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.SessionImpl] Scheduling collection removes/(re)creates/updates
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.SessionImpl] Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.SessionImpl] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.Printer] listing entities:
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.Printer] com.pendylum.main.model.SystemOption{systemOptionId=7, sectionName=TA, keywordValue=TSLOCKHOURS, optionValue=-5}
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.SessionImpl] executing flush
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.persister.EntityPersister] Updating entity: [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.SQL] update wf_system_option_paaz set section_name=?, keyword_value=?, option_value=? where paazpk=?
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.persister.EntityPersister] Dehydrating entity: [com.pendylum.main.model.SystemOption#7]
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.type.StringType] binding 'TA' to parameter: 1
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.type.StringType] binding 'TSLOCKHOURS' to parameter: 2
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.type.StringType] binding '-5' to parameter: 3
2005-05-04 11:08:06,896 DEBUG [net.sf.hibernate.type.ShortType] binding '7' to parameter: 4
2005-05-04 11:08:06,912 DEBUG [net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
2005-05-04 11:08:06,912 DEBUG [net.sf.hibernate.impl.BatcherImpl] closing statement
2005-05-04 11:08:06,912 DEBUG [net.sf.hibernate.impl.SessionImpl] post flush
2005-05-04 11:08:06,912 INFO [STDOUT] HibernateHelper: commitTransaction() successfully executed.
2005-05-04 11:08:06,912 INFO [STDOUT] HibernateHelper: Closing Session of this thread.