facebook

Hibernate reverse engineer when a new table is added

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

    Is there an easy way for MyEclipse to generate hibernate code for a new table only when that table is added to an existing schema which has been hibernate reverse-engineered before? By “easy”, I mean without having to do it over again for the modified schema.

    #300352 Reply

    Brian Fernandes
    Moderator

    Joe,
    I’m afraid not.

    Can you describe how you expect this to work? As soon as the DB Browser detects the new table, it would be immediately and automatically reverse engineered to all projects which contain other reverse engineered elements of that schema? Could you elaborate further?

    #300376 Reply

    Brian,

    Thank you for the prompt reply!

    I am just curiously checking if anybody has any trick different. I am satisfied with your answer just like finding that we don’t have a national healthcare, yet. I had a feeling before posting the question that the answer would be no(I might ask Barack later for any possiblity). I think your picturing of my situation is sufficient. The scenario is that with an initial schema of say 40 tables, there are all these nice cardinalities of 1-to-1, 1-to-m, m-to-m engineered into hibernate orms. After 2 months, suddenly 2 new tables are added to the already complicated schema. This is not unusual for any company if you agree.

    What I did is that I only REed(Reverse Engineer) the two tables and tables surrounding them into a separate project and manually migrate the generated files into the existing schema modifying existing files as I saw fit.

    Joe

    #300396 Reply

    Brian Fernandes
    Moderator

    Joe,

    I know exactly what you mean – no point wondering when you can find out for sure.

    Some notes that might help you with such tasks in the future (in case you aren’t already aware)

    1) You can select just the two tables you want to reverse engineer and choose an existing project; unless you enable the related tables option on the last page, only new classes will be created, existing POJOs should not be affected – of course, this would mean that any relationships between the existing tables and the new ones would not be picked up.

    2) If you haven’t already given it a try, you could try generating code with Abstract classes, you can leave the abstract classes untouched and put your modifications and customizations in the concrete classes which extend them. If you RE the same tables again, only the Abstract class will be modified, while your concrete classes will be left untouched.

    Hope this helps.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Hibernate reverse engineer when a new table is added

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