How to get full list from user table. in mapof it show just one user data?


#1
get("/userlist"){
        val user_list = hashMapOf<String,Any>()
        transaction {
            val user_r = Users.selectAll().orderBy(Users.userid, false).limit(5)
            for(u in user_r){
                user_list.put("userid",u[Users.userid]).toString()
                user_list.put("username",u[Users.username]).toString()
                user_list.put("password",u[Users.password]).toString()
            }
        }
        call.respond(FreeMarkerContent("users.ftl",user_list,"e"))
    }

#2

You are creating a map which holds 1 value for each key. I think what you want is a list of map mutableListOf<Map<String, Any>> and then transform your Entities to map.