-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problem with findByExample()
PostPosted: Thu Sep 28, 2006 5:28 am 
Newbie

Joined: Mon Sep 25, 2006 7:04 am
Posts: 7
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


Top
 Profile  
 
 Post subject: the database
PostPosted: Thu Sep 28, 2006 5:30 am 
Newbie

Joined: Mon Sep 25, 2006 7:04 am
Posts: 7
Department: idDepartment (PK)

User: login (PK)

Register: idDepartment(PK), login (PK)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.