2011-09-12 8 views
0

Hibernate 용 사용자 지정 리버스 엔지니어링 템플릿을 만들려고합니다. 온라인에서 볼 수있는 많은 템플릿에서 pojo, class, c2j와 같은 변수를 볼 수 있습니다. 내 질문은 어디에서 오는 변수입니까? 내가 언급 한 pojo가 BasicPOJOClass 엔티티라는 것을 알 수 있지만 템플릿에서 사용할 수있는 모든 변수를 찾을 수없는 것 같습니다.참조 된 Freemarker Hibernate 클래스는 어디입니까

예를 들어, hibernatetools의 일부 버전에서 웹에있는 ftl이 있습니다.

<#if ejb3> 
<#if pojo.hasIdentifierProperty()> 
<#if property.equals(clazz.identifierProperty)> 
${pojo.generateAnnIdGenerator()} 
<#-- if this is the id property (getter)--> 
<#-- explicitly set the column name for this property--> 
</#if> 
</#if> 
<#if c2h.isManyToOne(property)> 
<#--TODO support @OneToOne true and false-->  
${pojo.generateManyToOneAnnotation(property)} 
<#--TODO support optional and targetEntity-->  
${pojo.generateJoinColumnsAnnotation(property, cfg)} 
<#elseif c2h.isCollection(property)> 
${pojo.generateCollectionAnnotation(property, cfg)} 
<#else> 
${pojo.generateBasicAnnotation(property)} 
${pojo.generateAnnColumnAnnotation(property)} 
</#if> 
</#if> 

그냥 템플릿을 읽고, 당신은 CFG, clazz에, C2H과 EJB3로 사용 가능한 변수가 알고하지만 당신은 그들이 그들에 어떤 방법을 사용할 수 있습니다 무엇인지 모른다. 어떤 도움이라도 대단히 감사합니다.

답변

2

대부분의 FreeMarker 루트 컨텍스트 설정은 AbstractExporterGenericExporter 클래스에서 처리됩니다. 사용할 수있는 몇 가지 변수가있는 것 같습니다.

  • 유물
  • C2H
  • c2j
  • CFG
  • clazz에
  • 수출
  • template_path
  • POJO
  • outputdir

다른 모든 것이 실패하면 그 의미에 대해 알아 내기 위해 해당 소스 파일을 파헤쳐 야합니다.

HTH.

+0

감사 사령관 Chaquotay. 나는 필요한 변수를 많이 찾았습니다.이 주제에 대해 파고 들지 않아도 될 것으로 보입니다. –

관련 문제