Consider the following association Book has OneToMany Chapters
If i execute:
session.save(book)
session.save(chapter)
session.getTransaction().commit()
Hibernate generates insert query for Book and insert query for Chapter
But if i execute:
session.save(chapter)
session.save(book)
session.getTransaction().commit()
Hibernate executes insert query for chapter, insert query for book and update query for chapter.
Is there any way to do this in 2 inserts instead of 2 inserts and 1 update? (Assume primary key generation is similar to Identity and Chapter.Book is nullable)