facebook

adding cascade when reverse engineering with hibernate

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #289752 Reply

    Hello!

    I have a short question about the hibernate reverse engineering wizard.
    Everything works fine for me up until I want to automatically set cascade for reverse engineered table.

    I have read that there are DelegatingReverseEngineeringStrategy and also velocity templates that allows for custom settings during the wizard. However, I couldnt find a match on which of these approaches to use in the forums and the documentation.

    So my question is if DelegatingReverseEngineeringStrategy or velocity templates are the way to go for me? I want to let the wizard set cascade=”save-update” automatically on a table from the database that uses a many-to-many relationship in hibernate.

    Or is there something else that can “trigger” the wizard to automatically set cascade for tables in a database?

    With Kind Regards
    Anders

    #289841 Reply

    Brian Fernandes
    Moderator

    Anders,

    There is no way you can set some tables to cascade in the wizard.
    Templates would be the easiest way to add the cascade attribute to the table, you would need to modify the persistentclass.hbm.vm file to achieve this; however I cannot suggest a way in which you can detect that a given table is part of a M2M relationship in the template. If there is a small number of tables, you could consider hard-coding them into the template and doing a check against the name of the table, but the tool does not currently support a more robust technique.

    Hope this helps

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: adding cascade when reverse engineering with hibernate

You must be logged in to post in the forum log in