• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Comparing rows from 2 seperate datatable in Hibernate

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
reply
    Bookmark Topic Watch Topic
  • New Topic