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.
精彩评论