Hi,
I have a mapping of 'Agent' like this:
Code:
<class name="com.mycompany.model.Agent"
table="AGENTS" lazy="true">
<id name="id" column="AGENT_ID">
<generator class="native" />
</id>
<version name="version" column="version"
type="java.lang.Integer" />
<many-to-one name="phone" column="PHONE_ID"
class="com.mycompany.model.Phone" />
</class>
I have hibernate sql send to stdout so that I know what is the sql.
// see a sql statement here from hibernate
Agent agent = agentManager.getAgentByName('aName');
// do not see a sql statement here.
Phone phone = agent.getPhone();
[/code]
My question is why I don't see any sql statement when I do 'agent.getPhone()' the relationship is 'lazy', so I expect hibernate will query that only when I do agent.getPhone(), so I don't see that happening.
Can you please help me understand why?