From: Matt R. <ma...@ra...> - 2002-12-22 19:03:37
|
I have a user object and resume object, where there is a one-to-many relationship of users to resumes. I am expecting a couple of things to happen for me - and they aren't most likely because I haven't read the document and don't understand hibernate enough. One, when I add a new resume with the code below, I'm expecting a user to get a resume from this: user = dao.getUser("tomcat"); assertTrue(user != null); resume = new Resume(); resume.setName("sample resume"); resume.setDescription("dsd"); resume.setObjective("blah"); resume.setUserId(user.getId()); Resume returned = dao.addResume(resume); However, it doesn't - so I added the following: user.addResume(returned); And now the user gets a resume - is this expected behavior? If so, should I do this in a DAO (the hibernate implementation class) or in my business object? Secondly, is it possible to get the user's resume's with the dao.getUser() call? If so, do I have to do something special - as in - do I have to lookup the children using an OQL clause? I was *hoping* this was done for me automagically. Thanks, Matt |