Announcement Announcement Module
No announcement yet.
HibernateTemplate.find() doesn't work with Oracle fixedString=true property Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • HibernateTemplate.find() doesn't work with Oracle fixedString=true property

    Hi all,
    I have just migrated from informix to oracle. I use fixedString="true" by oracle driver property.
    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:
    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:
    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

  • #2
    Try the Hibernate forums - there should some workarounds by using probably a different HB dialect.