Hibernate persistence slow on One-To-Many
I have a quite large object tree structure that I persist with Hibernate. This should have been persisted with the root-node first and then the children and so on. However this was not the way th开发者_开发知识库at Hibernate did it, it persisted the child first and than updated the reference column in the child when the parent had been persisted. This is not an optimal way of doing it so I forced the One-To-Many (JoinColum) to be not null (nullable=false).
Now it turns out that everything is even slower, much much slower. I don't understand?!
If it is a bi-directional association you need to map one end as inverse (inverse attribute in xml and mappedBy if you are using annotations).
精彩评论