开发者

get hibernating mapping from application code

Is there a way to get the hibernate mapping from 开发者_C百科within my application code? for example, for the below mapping, I want to return createdDate given created_date from my application.

 <property
        name="createdDate"
        type="java.lang.String"
        column="created_date"
        length="45"
    />


You probably could do so by using Configuration to get the Property you need, for example:-

Configuration configuration = new Configuration().configure("hibernate.cfg.xml");
Property property = configuration.getClassMapping("EntityName").getProperty("createdDate");

... // use the API from Property

Here's the javadoc for Property where you can get the information you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜