Announcement Announcement Module
Collapse
No announcement yet.
can't save data while using Spring + hibernate (MSSQL) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • can't save data while using Spring + hibernate (MSSQL)

    It seems no error info in debug.
    but when i query in database,found no data has increased,why?
    my code :

    public ChatMan save(ChatMan man) {
    try {
    this.getHibernateTemplate().save(man);
    return man;
    } catch (DataAccessException e) {
    return null;
    }
    }

    why?

  • #2
    With this code:
    Code:
    catch (DataAccessException e) {
    return null;
    }
    you are hiding any exceptions thrown - add some logging and/or throw some kind of exception.

    Comment


    • #3
      i'm sure it has no Exception.

      public void saveMan(ChatMan man) {
      // TODO Auto-generated method stub
      try {
      getHibernateTemplate().saveOrUpdate(man);
      } catch (DataAccessException ex) {
      logger.info("error");
      logger.error(ex.getMessage());
      }
      }

      and i can get data from DB .
      but i can't save data.

      Comment


      • #4
        has anyone help me ?
        thanks.

        Comment


        • #5
          Can you post your configuration files and the debug log output.

          Comment

          Working...
          X