Hibernate Class Generation Using hbm2java
Subject:   Using annotation or XDoclet is better
Date:   2005-12-15 08:49:23
From:   lizjason
I would keep the mapping info and the Java class together using either annotation or XDoclet, depending JDK version you are using.
Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Using annotation or XDoclet is better
    2007-01-05 07:24:11  JiaLi [View]

    Makes sense to me too. We have legacy database schema, and I'm looking for ways to reverse enginnering into xdoclet tags in Java code. For certain reason, we can not use annotation. Do you know of a good tool? I tried Hibernate Tools (for Hibernate 3), but it doesn't seem to have the capability to generate xdoclet tags.
  • Using annotation or XDoclet is better
    2006-02-06 14:26:26  Wakaleo [View]

    This is often a matter of personal preference: some people will be more confortable writing (and maintaining) the mapping information directly in the Java source code, whereas others prefer centralising the mapping into dedicated mapping files. The first approach may be better if the same person maintains the mappings (including mapping optimisations such as caching), though I personnaly find it harder to read when the mappings are spread through the code in the form of annotations. However, as often is the case, personal preferences are important, and it is often better to use the approach with which you are the most confortable.