开发者

Hibernate fetch MAP optimization (minimize SELECT statements)

开发者 https://www.devze.com 2023-02-10 10:20 出处:网络
How to fetch a map with no additional select statements. I have a hbm like this: <map name=\"officeSet\" table开发者_如何转开发=\"office_employee\" inverse=\"true\" lazy=\"false\"batch-size=\"1

How to fetch a map with no additional select statements.

I have a hbm like this:

            <map name="officeSet" table开发者_如何转开发="office_employee" inverse="true" lazy="false"  batch-size="100" cascade="all">
                <key column="employee_id"/>
                <map-key-many-to-many column="office_id" class="by.epam.hibernatetask.model.Office"/>
                <element column="employee_position" type="java.lang.String"/>
            </map>

with lazy="false" and fetch="join" I can fetch a SET for 3 hibernate queries but it doesn't work for MAP. Can't find the solution.

0

精彩评论

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