开发者

get hibernating mapping from application code

开发者 https://www.devze.com 2023-02-12 14:05 出处:网络
Is there a way to get the hibernate mapping from 开发者_C百科within my application code? for example, for the below mapping, I want to returncreatedDate given created_date from my application.

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

精彩评论

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