|
From: Matt R. (JIRA) <no...@at...> - 2006-07-20 13:47:23
|
Column lazy fetch via annotation doesn't work
---------------------------------------------
Key: HHH-1925
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1925
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3, 3.2.0.cr2
Environment: Hibernate 3.1.2 and 3.2.0.cr2, JDK 1.5.0_04
Reporter: Matt Read
I have annotated a column in my Journal class as follows:
@Basic(fetch = FetchType.LAZY)
@Column(name = "jouEntryDate", unique = false, nullable = true, insertable = true, updatable = true, length = 23)
public Date getEntryDate() {
return this.entryDate;
}
And I then execute the following test:
public void testLazyColumnLoading() {
Journal journal = (Journal) getSession().load(Journal.class, new Long(1));
assertFalse(Hibernate.isPropertyInitialized(journal, "entryDate"));
logger.debug("Journal narrative: " + journal.getJouNarrative());
assertFalse(Hibernate.isPropertyInitialized(journal, "entryDate"));
logger.debug("Journal entry date: " + journal.getEntryDate());
assertTrue(Hibernate.isPropertyInitialized(journal, "entryDate"));
}
Which generates the following SQL:
14:44:39,376 DEBUG SQL -
/* load com.catlin.da.insuranceledger.model.Journal */ select
journal0_.jouSID as jouSID11_0_,
journal0_.jouContraSIDjou as jouCont21_11_0_,
journal0_.jouContraOfSIDjou as jouCont22_11_0_,
journal0_.jouSIDjgp as jouSIDjgp11_0_,
journal0_.jouStatusENUM as jouStatu2_11_0_,
journal0_.jouReplaceOfSIDjou as jouRepl24_11_0_,
journal0_.jouNarrative as jouNarra3_11_0_,
journal0_.jouFunctionalAmtTotal as jouFunct4_11_0_,
journal0_.jouEntryDate as jouEntry5_11_0_,
journal0_.jouCodejty as jouCodejty11_0_,
journal0_.jouLedgerIDlgr as jouLedg26_11_0_,
journal0_.jouInsDate as jouInsDate11_0_,
journal0_.jouInsSIDusr as jouInsSI7_11_0_,
journal0_.jouModVersn as jouModVe8_11_0_,
journal0_.jouUpdDate as jouUpdDate11_0_,
journal0_.jouUserLastUpdSIDusr as jouUser10_11_0_,
journal0_.jouAdditionalRef as jouAddi11_11_0_,
journal0_.jouInstantiatingActionENUM as jouInst12_11_0_,
journal0_.jouAccountingPeriodCodeacp as jouAcco27_11_0_,
journal0_.jouSettlementMethodENUM as jouSett13_11_0_,
journal0_.jouSourceTable as jouSour14_11_0_,
journal0_.jouSourceID as jouSour15_11_0_,
journal0_.jouSIDcll as jouSIDcll11_0_,
journal0_.jouSIDcmv as jouSIDcmv11_0_,
journal0_.jouSIDinl as jouSIDinl11_0_,
journal0_.jouSIDrks as jouSIDrks11_0_,
journal0_.jouPostedBySIDusr as jouPost18_11_0_,
journal0_.jouInsuredSIDpty as jouInsu30_11_0_,
journal0_.jouPayeePayerSIDpty as jouPaye31_11_0_,
journal0_.jouBrokerSIDpty as jouBrok32_11_0_,
journal0_.jouMessageRef as jouMess19_11_0_,
journal0_.jouOrigMessageRef as jouOrig20_11_0_
from
jouJournal journal0_
where
journal0_.jouSID=?
I.e. the SQL includes entryDate and the test fails at the 2nd assert.
Hibernate doesn't appear to honouring the @Basic(fetch = FetchType.LAZY) annotation, even though Hibernate debug indicates that it has recognised it.
What am I doing wrong?
Thanks,
Matt.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
|