Help coderanch get a
new server
by contributing to the fundraiser

shaun koo

Greenhorn
+ Follow
since Oct 16, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shaun koo

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.
Hello people, I am new to hibernate and its ORM function.

Here is my problem:

I have Users and Groups; 1 User belongs to multiple Groups, and 1 Group can contain multiple users.

I have read many articles and forum threads regarding this issue (e.g. http://www.hiberbook.com/HiberBookWeb/learn.jsp?tutorial=19mappingmanytomanyrelationships).

However, I would like to know if I am able to retrieve a list of the join_table, and use it to display the contents (e.g. ID_USER and ID_GROUPS). Even though, the UserGroup model class doesn't exist.

I have read in some tutorials that a "join table" isn't required if there is no additional columns. However, without a "join table" model class. Is it possible to create and retrieve a List<Join_table> to display its contents?