Hello,
My DB is:
Department 1..1------0..n Register 0..n----------1..1 User
iDDep(PK) iDDep(PK) login(PK)
login(PK)
I want to create a query for getting a list of departments which a user is registered in.
I use the DAOS generated by MyEclipse:
List departamts = null;
UserDAO ud = new UserDAO();
//Get user "jonh"
User usu = ud.findById("john");
RegisterDAO rd = new RegisterDAO();
//Set the example-> Register with user "jonh"
Register reg = new Register();
RegistrerId regId = new RegisterId();
regId.setUsuarioLogin(login);
regId.setDepartamentoIdDepartamento(null);
reg.setId(regId);
reg.setDepartamento(null);
reg.setUsuario(usu);
departamentos = rd.findByExample(reg);
Finally it obtains all rows of Register, not only the ones with login "jonh". Can somebody tell me what's going on?
Thank you very much
|