Convert XML-based configuration to annotations

Is there any utility for converting XML based configuration files (like Spring or Hibernate) to annotations? If it were not advisable to build such an instrument?

+4
source share
1 answer

Go to the next page

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

And see paragraph 4.4.2.

POJO java code exporter (<hbm2java>)

It says:

<hbm2java> is a java code generator. You can use the options to control JDK 5 syntax and whether to annotate POJOs using EJB3 / Hibernate annotations .

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

The ejb3 attribute says:

The code will contain EJB 3 features, for example. using annotations from javax.persistence and org.hibernate.annotations

+1
source

All Articles