Hello.
I have a beginners question:
Imagine a relation between folder and files. A folder contains one or more files or some subfolders.
I am creating a folder using a service implementation which uses a folderDao to create the object. This works fine. The database is populated as desired.
If I am creating a folder and then I am creating a file which is related to this folder as child this works fine within one junit test method, too. The database is populated correctly after this.
BUT if I am creating a folder and then a file which is related to that folder as described above and then I want to fetch this folder object again, the reference to the file of this folder is alway null (within one junit test-method)-call. If i am doing this in two junit-testmethods (First create folder and file, Second fetch the folder and its property file) it is fine!
Does anyone can give me a hint, why this behaves like that? I am assuming, that only after a flush into the database the objects and the relations are filled correctly? Is this the right way?
Thank you a lot.
Best regards.
|