Hi, I'm quite new to hibernate and I'm working on a project that will help me to learn it. I have a query regarding widely understood metadata. In my project, I have several tables that contain system settings, entity definitions, users etc. Can you help me deciding on global approach how to access medatada. For sake of simplicity, lets focus on three entities: users, security profiles and privileges. Each user must have at least one security profile assigned. Each security profile has list of privileges. Initially I planned to write one object called Metadata. This object would have the following properties: users, securityProfiles. Both would be lists of hibernate POJO classes. The whole metadata would be loaded on startup, and then session would be dropped. I have the following concern: if users[i] has pointer to securityProfile object sc, and I find the same security profile insecurityProfiles - let's say on index j - will sc==securityProfiles[j]? In other works, if I change security profile taken from securityProfiles list, will the change be visible in security profiles assigned to each user object? Is this good approach? Or should I just rely on level 2 cache and do hibernate queries whenever I need to get data? Or maybe there is a better approach? Kind Regards Marcin Junger
|