I know this is waaaay late, but it doesn't appear as though this problem has
been fixed in current versions of Appfuse (2.0.2).  The solution to this
problem is to change UserDao to be able to find the user's password based
upon the userId (invariant across edits).  

I've added the following lines to my UserDao interface:

/**
         * Retrieve a password by userid, or null if none is found
         */

        @Transactional(propagation = Propagation.NOT_SUPPORTED)
        String getUserPasswordForId(String id);

        @Transactional(propagation = Propagation.NOT_SUPPORTED)
        String getUserPasswordForId(Long id);

Implemented as follows in UserDaoHibernate:


public String getUserPasswordForId(String id) {
                return getUserPasswordForId(Long.parseLong(id));
        }

        public String getUserPasswordForId(Long id) {
                User u = get(id);
                return u == null ? null : u.getPassword();
        }


And changed my UserManagerImpl to use:


String currentPassword = dao.getUserPasswordForId(user.getId());

If no one has any objections, would someone mind updating those classes?  Or
has this already been fixed in the nightly builds?

Josiah Haswell


Miguel Romero wrote:
> 
> I´m testing my appfuse project and i have founded a exception when i have
> updated the username with any user.
> 
> ¡Data Access Failure  Incorrect result size: expected 1, actual 0!
> 
> The exception can be seen in demo´s appfuse web:
> 
> http://demo.appfuse.org/appfuse-struts/login.jsp
> 
> 1) login user/user, admin/admin,...
> 2) edit user
> 3) change username
> 4) save
> 
> result: ¡Data Access Failure  Incorrect result size: expected 1, actual 0!
> 
> 
> 1) login admin/admin,...
> 2) list users
> 3) edit user
> 4) change username
> 5) save
> 
> result: ¡Data Access Failure  Incorrect result size: expected 1, actual 0!
> 
> this behaviour is due to:
> In class : UserManagerImpl
> 
>     public User saveUser(User user) throws UserExistsException {
> ...
>                 // Existing user, check password in DB
>                 String currentPassword =
> dao.getUserPassword(user.getUsername());
> ...
> 
> getUserPassword returns null because getUsername is the new username and
> this one doesn´t exist in BD
> 
> what is the solution?
> thanks!
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Data-Access-Failure-Incorrect-result-size%3A-expected-1%2C-actual-0-tp19220809s2369p21881153.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to