[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - jboss-4.0.4GA & hibernate 3.1.3: version updated on Select??

benoitx do-not-reply at jboss.com
Wed Sep 27 05:23:08 EDT 2006


Hi,

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"

query.list();

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

Benoit

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3974478#3974478

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3974478



More information about the jboss-user mailing list