• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comparing rows from 2 seperate datatable in Hibernate

 
shaun koo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I have the following method.

public List<Usuarios> rowComparision() {
listOfUsuarios = getListOfUsuarios();
listOfUserGroups=getListOfUserGroups();

if(listOfUserGroups !=null) {

for(int i=0;i<listOfUsuarios.size();i++) {
for(int a=0;a< listOfUserGroups.size();a++){
if(listOfUsuarios.get(i).getId_usuario()== listOfUserGroups.get(a).getId_usuario()){
listOfUsuarios.remove(i);
}
}
}
}
return listOfUsuarios;
}


I call this method in my "finishAddUserGroups" method:

public void finishAddUsuariosGrupos() {
this.grps = grpDAO.getGrps(var2);
this.user = userDAO.getUsuarios(var1);

this.userGroups.setId_grupo(var2);
this.userGroups.setId_usuario(var1);
this.userGroups.setGroup(grps);
this.userGroups.setUser(user);
rowComparision();
userGrpDAO.saveUsuariosGrupos(userGroups);

}


This method allows me to compare rows from 2 separate datatables. When I select a user from the datatable and add it to the user group datatable, the row of the datatable is removed. However, I am unable to get it to work, any thoughts on this?

I have attached a diagram of how it's supposed to look like.
Untitleddrawing.png
[Thumbnail for Untitleddrawing.png]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic