Results 1 to 2 of 2

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

  1. #1
    Join Date
    Jan 2006
    Posts
    9

    Default 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:
    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

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Try the Hibernate forums - there should some workarounds by using probably a different HB dialect.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •