javahibernatehbm2java

Should the hibernate generated code be changed to fit the needs?


In my opinion should the auto-generated code generally/preferred not be changed by hand, because we can not regeneration anything. But one experienced hibernate user tell me he will always change the hbm2java generated code to fit his needs. "Fit needs" is also important, so I am not sure whether this principal good is.


Solution

  • should the auto-generated code generally/preferred not be changed by hand?

    --> You should not change the code by hand, because if you change the code manually and if next time you again auto generate pojo classes. You may have a lot of changes to do and it will be difficult to maintain your manual changes. Again being human to make mistakes, if you miss major change, then it is really going to be very difficult for you.

    But one experienced hibernate user tell me he will always change the hbm2java generated code to fit his needs.

    --> You can change the code generation (revenge) script to generate classes according to your need instead of making manual changes in generated code.