You are given 100 stations and distance between each adjacent stations. Now you have to select 10 stations(means 10 hops) among those 100 stations in such a way that maximum of distance between any 2 hops will be minimised. By default 1 and 100 stations are selected , so you need to choose only 8 more stations.


Question: Cascading save not working with Hibernate 4 and @OneToMany
Answer: save(), persist() and merge() are three different operations. If you want to cascade the save() operation, you need to use the Hibernate annotation

@Cascade(CascadeType.SAVE_UPDATE)


or 

cascade = CascadeType.ALL


, which also include the Hibernate proprietary operations.