hello everybody:
I am a new hibernator,I want a virtual view entity of hibernate level.
as we know we can use " create view ViewName as select blablabla" to create a view entity of database level,but it is a little complex because I have to mapping it to a POJO,then use the POJO.
today ,I want a view entity of hibernate level,only need a few configuration(may be write xml file) to make it out, then I can use HQL statement to query it, that is what i want.
I have heard that the new version hibernate has the function that I want,but I dont know how to use,so post the question , thanks.
notice , the ofbiz has the function ,the script below create a view entity of ofbiz level,and we can use it by query " List employeeList =delegator.findByAnd("EmpolyeeDepartmentDetailInfo",UtilMisc.toMap("employeeId",emId)); "
<view-entity entity-name="EmpolyeeDepartmentDetailInfo" package-name="org.ofbiz.commonapp.kmp" title="员工部门的详细信息" copyright="GEI">
<description/>
<member-entity entity-alias="EM" entity-name="Empolyee"/>
<member-entity entity-alias="DP" entity-name="Department"/>
<alias entity-alias="EM" name="employeeId"/>
<alias entity-alias="EM" name="employeeName"/>
<alias entity-alias="DP" name="departmentTitle"/>
<key-map field-name="CurrentDepartmentId" rel-field-name="departmentId"/>
</view-link>
</view-entity>
|