Migrate from Hibernate XML configuratation to JPA/Entity Annotations based
configuration
----------------------------------------------------------------------------------------
Key: MIFOS-2696
URL: http://mifosforge.jira.com/browse/MIFOS-2696
Project: mifos
Issue Type: Improvement
Components: Configuration
Affects Versions: Unscheduled
Reporter: Udai Gupta
Fix For: Unscheduled
Attachments: hbm2jpaPOJOfromMIFOShbm.zip, HBMxml2AnnotationsHint.patch
Hibernate, like all other object/relational mapping tools, requires metadata
that governs the transformation of data from one representation to the other.
In Hibernate 2.x mapping metadata is most of the time declared in XML text
files. Alternatively XDoclet can be used utilizing Javadoc source code
annotations together with a compile time preprocessor.
The same kind of annotation support is now available in the standard JDK,
although more powerful and with better tools support. IntelliJ IDEA and Eclipse
for example, support auto-completion and syntax highlighting of JDK 5.0
annotations which are compiled into the bytecode and read at runtime using
reflection. No external XML files are needed.
The EJB3 specification recognizes the interest and the success of the
transparent object/relational mapping paradigm. It standardizes the basic APIs
and the metadata needed for any object/relational persistence mechanism.
Hibernate EntityManager implements the programming interfaces and lifecycle
rules as defined by the EJB3 persistence specification and together with
Hibernate Annotations offers a complete (and standalone) EJB3 persistence
solution on top of the mature Hibernate core.
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single
There is patch attached with this issue showing how this can be achieved with
least modification.
There is zip file attached with this issue which contain pojo generated by
hibernate tool (with EJB3 and JDK5)
https://www.hibernate.org/hib_docs/tools/reference/en/html_single/#d0e1193
We can not use this generated code because
- These POJO might be incomplete, for example query (named queries) are not
add due to http://opensource.atlassian.com/projects/hibernate/browse/HBX-465,
but adding named queries are quite simple using annotations
- The Classes in Mifos might not be clean POJO (which is bad but for now we
have to live with that)
- We have to be very careful while applying the annotations and removing
respective xml config file so that meta-data for hibernate remains same.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mifosforge.jira.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues