i'am trying to load a user bean from db via hibernate. the user bean is a session-scoped bean (aop-proxy). i've added the ScopedBeanInterceptor, so now i don't get an unknown enitity exception anymore.
but when i'm trying to load it with session.load() the bean afterwards hasn't changed.
spring-config:
java-dao-code:Code:<bean id="user" class="testapp.models.User" scope="session"> <aop:scoped-proxy/> </bean>
when i call the dao-function with a new instance of User and id 1 it works (log-message is user 'Administrator' found!), but when i call it with an aop-proxied User and id 1 i get the log-message user 'unset' found!Code:public void findById(User user, Long id) { if (user == null) throw new IllegalArgumentException("user is NULL"); if (id == null) throw new IllegalArgumentException("id is NULL"); Session session = sessionFactory.openSession(); user.setName("unset"); session.load(user, u.getId()); LOG.debug("user '" + user.getName() + "' found!"); // user 'unset' found! session.close(); }
can you help me?


Reply With Quote