-->
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: HibernateTemplate.find() doesn't work with Oracle fixedStrin
PostPosted: Mon Jan 23, 2006 10:14 am 
Newbie

Joined: Mon Jan 23, 2006 9:52 am
Posts: 1
Hi all,
I am using hibernate through springframework. I post these problem to springframework forum too, but they send me here. I have just migrated from informix to oracle. I use fixedString="true" by oracle driver property.

Quote:
If the value of this property is "true", JDBC will use FIXED CHAR semantic when setObject is called with a String argument. By default JDBC uses VARCHAR semantics. The difference is in blank padding.


But now some hibernate queries doesn't work but if I use JdbcTemplate it works. Unfortunately I need use hibernate in some cases.

Small example:
Code:
public User getUserByLogin(String login) {
  String queryString = "from " + User.class.getName() +  " as user where user.login = ?";
  HibernateTemplate temp = getHibernateTemplate();       
  List list = temp.find(queryString, login);
  return (User) list.get(0);
}


but the list is empty, inspite of I am sure that login really exists.
If I use JdbcTemplate like this:
Code:
String queryString = " SELECT * from gusr where login = ?";
List list = getJdbcTemplate().queryForList(queryString, new Object[] {login});


returned list is OK, but then I cannot easily cast result to User object.

does anybody know what I am doing wrong?

thanks for your ideas

Hibernate version:3.0.5

Name and version of the database you are using: Oracle 10g


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.