Hello, I'm quite a beginner using Hibernate and after reading several tutorials the following issue has arisen in my project. I've an entity that has a large number of relationships, where some of them have also several relationships with other entities. If my understanding of the tutorials is right, I should use “session.update(…)” only if I am completely sure that the main entity hasn't several attributes pointing to the same foreign key. Therefore, I am using “session.merge(…)” instead of save. To this end, in the entity mapping, I've set every foreign key with “cascade = merge”. Hosver, I have a problem doing that way, when I call “session.merge(…)” hibernate generates a query with more than 61 joins, which it is not supported by MySQL. Hence, I have tried to use “session.get(…)” before using the merge . Nevertheless, this solution also generates a query with more than 61 joins due to one of the relationships.
Do you have any suggestions in order to solve my problem?
Thanks in advance.
|