0 Replies Latest reply on Sep 27, 2006 5:23 AM by Benoit Xhenseval

    jboss-4.0.4GA & hibernate 3.1.3: version updated on Select??

    Benoit Xhenseval Newbie


      I have searched this forum but could not find a match to my question, I apologise if it is already answered (please point me to the answer).

      I recently noticed that the version number on hibernate objects gets updated on SELECT and return from a stateless session bean (non ejb3).

      My EJB calls a 'reader' that simply returns a list via "select x from MyObject as x"


      and I get the session like this:
      protected Session getSession() {
      try {
      final InitialContext ctx = new InitialContext();
      final SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory");
      return factory.getCurrentSession();
      } catch (final NamingException e) {
      throw new HibernateException(e);

      and the query:
      query = s.createQuery("select x from MyObject as x");

      My object is defined in hbm with
      <version name="version" unsaved-value="negative" />

      When the object is returned from the EJB, Jboss seems to update the version....

      WHY??? Nothing has changed?

      Any pointer most appreciated and will earn my eternal gratitude for at least 1 minute.

      Many thanks