- This topic has 3 replies, 2 voices, and was last updated 15 years, 5 months ago by Brian Fernandes.
-
AuthorPosts
-
joehuangathomeMemberIs 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.
Brian FernandesModeratorJoe,
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?
joehuangathomeMemberBrian,
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
Brian FernandesModeratorJoe,
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.
-
AuthorPosts