5 Replies Latest reply on Aug 18, 2009 10:32 AM by Ronald van Kuijk

    Is there a way to define the cascade order?

    Jun Li Newbie

      Hi all,


      Say I have the following.


      public class Client {
      @OneToMany(mappedBy = "client", cascade = CascadeType.ALL)
      private List<ClientName> names = new ArrayList<ClientName>();
      
      @OneToMany(mappedBy = "client", cascade = CascadeType.ALL)
      private List<Address> addresses = new ArrayList<Address>();
      }
      



      Is there a way to tell hibernate to cascade 'names' first then 'addresses'?
      The cascade order is important as there're constraints in DB, if 'addresses' is saved before 'names' it will fail.


      Thx in advance.