문제

My current setup using hibernate uses the hibernate.reveng.xml file to generate the various hbm.xml files. Which are then turned into POJOs using hbm2java. We spent some time while designing our schema, to place some pretty decent descriptions on the Tables and there columns. I am able to pull these descriptions into the hbm.xml files when generating them using hbm2jhbmxml.

So I get something similar to this:

<class name="test.Person" table="PERSONS">
  <comment>The comment about the PERSONS table.</comment>
  <property name="firstName" type="string">
      <column name="FIRST_NAME" length="100" not-null="true">
          <comment>The first name of this person.</comment>
      </column>
  </property>
  <property name="middleInitial" type="string">
      <column name="MIDDLE_INITIAL" length="1">
          <comment>The middle initial of this person.</comment>
      </column>
  </property>
  <property name="lastName" type="string">
      <column name="LAST_NAME" length="100">
          <comment>The last name of this person.</comment>
      </column>
  </property>
</class>

So how do I tell hbm2java to pull and place these comments in the created Java files?

I have read over this about editing the freemarker templates to change the way code is generated. I under stand the concept, but it was not to detailed about what else you could do with it beyond there example of pre and post conditions.

도움이 되었습니까?

해결책

새 ID로 사용자 정의 목록 정의를 만들면 기본 템플릿에 연결된 상자 기능 중 일부가 꺼집니다.

List instance 사용자 정의 스키마 .이렇게하면 사용자 정의 목록을 배포하고 모든 기능을 유지할 수 있습니다.

두 번째 방법은 동일한 유형의 정의 정의를 만드는 것입니다.그러나 그것은 추천하지 않습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top