转换基于XML的配置注解 [英] Convert XML based configuration to Annotations

查看:210
本文介绍了转换基于XML的配置注解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可用的转换基于XML配置文件的任何实用程序注释(在春季或休眠说)?如果没有这将是值得建立这样一个工具?


解决方案

去以下页

  https://www.hibernate.org/hib_docs/tool​​s/reference/en/html/ant.html

和见项目4.4.2。

POJO的Java code出口(小于调用:hbm2java>)

它说:


  

<&调用:hbm2java GT;是一个java codegenerator。控制阉JDK 5语法选项可以用来和是否POJO应EJB3被标注/ Hibernate注解


 < hibernatetool DESTDIR =$ {} build.dir /生成>
    <结构的ConfigurationFile =hibernate.cfg.xml中/>
    <调用:hbm2java JDK5 =真EJB3 =真/>
< / hibernatetool>

关于EJB3的属性,它说:


  

code将包含EJB 3的功能,例如使用注释从javax.persistence和org.hibernate.annotations


Is there any Utility available to convert XML based config files (say in Spring or Hibernate) to Annotations? If not would it be worthwhile to build such a tool?

解决方案

Go to the following page

https://www.hibernate.org/hib_docs/tools/reference/en/html/ant.html

And see item 4.4.2.

POJO java code exporter (<hbm2java>)

It says:

<hbm2java> is a java codegenerator. Options for controlling wether JDK 5 syntax can be used and whether the POJO should be annotated with EJB3/Hibernate Annotations.

<hibernatetool destdir="${build.dir}/generated">
    <configuration configurationfile="hibernate.cfg.xml"/>
    <hbm2java jdk5="true" ejb3="true"/>
</hibernatetool>

About ejb3 attribute, it says:

Code will contain EJB 3 features, e.g. using annotations from javax.persistence and org.hibernate.annotations

这篇关于转换基于XML的配置注解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆