HibernateD and DDBC - ORM and DB abstraction layer for D

Vadim Lopatin coolreader.org at gmail.com
Mon Apr 15 23:05:24 PDT 2013


On Saturday, 13 April 2013 at 16:23:04 UTC, michaelc37 wrote:
> First off; Awesome project (just discovered this).
>
> Is it possible set up the mapping externally in some sort of 
> xml configuration file (without using attributes)right now?
> If not, is it planned for future?
>
> The reason i ask is because i started playing around with 
> nhibernate recently, and really like the fact that i did not 
> have to polute(for lack of a better term) the code file with 
> attributes.
>
> e.g.
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>                    assembly="Something.Core"
>                    namespace="Something.Core.Data.Models">
>
>   <class name="User">
>     <id name="Id">
>       <generator class="native"></generator>
>     </id>
>     <property name="FirstName" />
>     <property name="LastName" />
>   </class>
>
> </hibernate-mapping>

It's possible to implement this feature, although it would 
require compile-time XML parsing.
But I don't see big benefits from it. It's inconvenient and error 
prone. Properties of the same entity should be edited in two 
separate files, and kept in sync.

Historically, XML annotations were replaced with @ annotations in 
JPA/Hibernate once Java got support of @annotations.
Even XML files were usually generated automatically from JavaDoc 
annotations inside comments.


More information about the Digitalmars-d-announce mailing list