Golly97;
Define all but the two properties of the Person class as lazy="true". Something like this:
Code:
<class name="Person" ........
<property name="firstName" lazy="false" ....
</property>
<property name="lastName" lazy="false" ....
</property>
<property name="lazyField1" lazy="true" ....
</property>
<property name="lazyField2" lazy="true" ....
</property>
.
.
.
.
<property name="lazyField6" lazy="true" ....
</property>
</class>
The your criteria query would look like this:
Code:
for(Iterator iter = session.createCriteria(Person.class).list().iterator(); iter.next();) {
Person person = (Person)iter.next();
System.out.println("First Name: " + person.getFirstName());
System.out.println("Last Name: " + peson.getLastName());
}
//Nicholas