-
-
Save sebduggan/175d8979e0c7d2c455be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component output="false" persistent="true" | |
{ | |
// identifier | |
property name="genreid" fieldtype="id" setter="false" generator="identity"; | |
// properties | |
property name="genre"; | |
property name="genreurlsafe"; | |
property name="magazines" cfc="magazine" singularname="magazine" fieldtype="one-to-many" fkcolumn="frn_genreid"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[localhost]:Hibernate: | |
[localhost]: select | |
[localhost]: magazine0_.magazineid as magazineid284_, | |
[localhost]: magazine0_.title as title284_, | |
[localhost]: magazine0_.titleurlsafe as titleurl3_284_, | |
[localhost]: magazine0_.embargo as embargo284_, | |
[localhost]: magazine0_.releasedate as released5_284_, | |
[localhost]: magazine0_.overview as overview284_, | |
[localhost]: magazine0_.issueprice as issueprice284_, | |
[localhost]: magazine0_.issueaccessdays as issueacc8_284_, | |
[localhost]: magazine0_.frn_genreid as frn9_284_ | |
[localhost]: from | |
[localhost]: magazine magazine0_ | |
[localhost]: order by | |
[localhost]: magazine0_.title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[localhost]:Hibernate: | |
[localhost]: select | |
[localhost]: magazine0_.magazineid as magazineid284_1_, | |
[localhost]: magazine0_.title as title284_1_, | |
[localhost]: magazine0_.titleurlsafe as titleurl3_284_1_, | |
[localhost]: magazine0_.embargo as embargo284_1_, | |
[localhost]: magazine0_.releasedate as released5_284_1_, | |
[localhost]: magazine0_.overview as overview284_1_, | |
[localhost]: magazine0_.issueprice as issueprice284_1_, | |
[localhost]: magazine0_.issueaccessdays as issueacc8_284_1_, | |
[localhost]: magazine0_.frn_genreid as frn9_284_1_, | |
[localhost]: subsprices1_.frn_magazineid as frn4_284_3_, | |
[localhost]: subsprices1_.subspriceid as subspric1_3_, | |
[localhost]: subsprices1_.subspriceid as subspric1_282_0_, | |
[localhost]: subsprices1_.months as months282_0_, | |
[localhost]: subsprices1_.price as price282_0_, | |
[localhost]: subsprices1_.frn_magazineid as frn4_282_0_ | |
[localhost]: from | |
[localhost]: magazine magazine0_ | |
[localhost]: left outer join | |
[localhost]: subsprice subsprices1_ | |
[localhost]: on magazine0_.magazineid=subsprices1_.frn_magazineid | |
[localhost]: where | |
[localhost]: magazine0_.magazineid=? | |
[localhost]: order by | |
[localhost]: subsprices1_.months |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[localhost]:Hibernate: | |
[localhost]: select | |
[localhost]: magazine0_.magazineid as magazineid14_, | |
[localhost]: magazine0_.title as title14_, | |
[localhost]: magazine0_.titleurlsafe as titleurl3_14_, | |
[localhost]: magazine0_.embargo as embargo14_, | |
[localhost]: magazine0_.releasedate as released5_14_, | |
[localhost]: magazine0_.overview as overview14_, | |
[localhost]: magazine0_.issueprice as issueprice14_, | |
[localhost]: magazine0_.issueaccessdays as issueacc8_14_, | |
[localhost]: magazine0_.frn_genreid as frn9_14_ | |
[localhost]: from | |
[localhost]: magazine magazine0_ | |
[localhost]: order by | |
[localhost]: magazine0_.title | |
[localhost]:Hibernate: | |
[localhost]: select | |
[localhost]: subsprices0_.frn_magazineid as frn4_14_1_, | |
[localhost]: subsprices0_.subspriceid as subspric1_1_, | |
[localhost]: subsprices0_.subspriceid as subspric1_12_0_, | |
[localhost]: subsprices0_.months as months12_0_, | |
[localhost]: subsprices0_.price as price12_0_, | |
[localhost]: subsprices0_.frn_magazineid as frn4_12_0_ | |
[localhost]: from | |
[localhost]: subsprice subsprices0_ | |
[localhost]: where | |
[localhost]: subsprices0_.frn_magazineid=? | |
[localhost]: order by | |
[localhost]: subsprices0_.months |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component output="false" persistent="true" | |
{ | |
// identifier | |
property name="issueid" fieldtype="id" setter="false" generator="identity"; | |
// properties | |
property name="issueyear"; | |
property name="issuetitle"; | |
property name="issuetitleurlsafe"; | |
property name="embargo" default="0"; | |
property name="releasedate"; | |
property name="highlights"; | |
property name="price"; | |
property name="freetomembers" default="0"; | |
property name="zmagsidnum"; | |
property name="zmagsidchar"; | |
property name="zmagspreview"; | |
property name="coverimageid"; | |
property name="magazine" cfc="magazine" fieldtype="many-to-one" fkcolumn="frn_magazineid" inverse="true"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component output="false" persistent="true" | |
{ | |
// identifier | |
property name="magazineid" fieldtype="id" setter="false" generator="identity"; | |
// properties | |
property name="title"; | |
property name="titleurlsafe"; | |
property name="embargo" default="0"; | |
property name="releasedate"; | |
property name="overview"; | |
property name="issueprice"; | |
property name="issueaccessdays" default="60"; | |
property name="genre" cfc="genre" fieldtype="many-to-one" fkcolumn="frn_genreid" inverse="true" cascade="all"; | |
property name="subsprices" cfc="subsprice" singularname="subsprice" fieldtype="one-to-many" fkcolumn="frn_magazineid" orderby="months" cascade="all-delete-orphan" fetch="join"; | |
property name="issues" cfc="issue" singularname="issue" fieldtype="one-to-many" fkcolumn="frn_magazineid" orderby="releasedate desc"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component output="false" persistent="true" | |
{ | |
// identifier | |
property name="subspriceid" fieldtype="id" setter="false" generator="identity"; | |
// properties | |
property name="months"; | |
property name="price"; | |
property name="magazine" cfc="magazine" fieldtype="many-to-one" fkcolumn="frn_magazineid" inverse="true"; | |
} |
What do you see in the logs when you do this:
mags = EntityLoad('magazine');
test = mags[1].getIssues();
Terry,
The "joined" table is now subsprice, so I did:
mags = EntityLoad('magazine');
test = mags[1].getSubsPrices();
The log showed exactly the same as in hibernate-1.log. If I do:
mags = EntityLoad('magazine');
test = mags[1].getSubsPrices().getPrice();
...I get the results in hibernate-3.log.
So between 1 and 2 I understand what's going on. You never request the child element so lazyloading kicks in and only loads what you are dispaling, so no need for the join loading.
I have no idea what is going on in 3. But it looks pretty efficient to me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've set up a
fetch="join"
relationship between the magazine and subsprice entities.If I use
to retrieve a list of all the magazines, the SQL log shows hibernate-1.log. But if I request a single entity:
the SQL log shows hibernate-2.log - and is employing the expected join behaviour.