author:publication=1:n
i had set the lazy="true" in the author.hbm.xml,but i run the java code,it looks like the lazy="true" is not acted as my wish.
com.one2many.Author objAuthorFind = (com.one2many.Author)objSession.load(com.one2many.Author.class,"PersonNo1");
com.one2many.Publication objPublication = null;
String strResult = objAuthorFind.getALIAS();
System.out.print(strResult);
java.util.Iterator objIterator = objAuthorFind.getpublications().iterator();
while(objIterator.hasNext())
{
objPublication = (com.one2many.Publication)objIterator.next();
//★★★★★
System.out.println(objPublication.getbookName());
}
at the ★★★★★,it also can provide the right fields value of the database,but i had set the i set the lazy="true" in the author.hbm.xml,it select the author entity from database,but it also select the publication entity from database,but why,the publication entity would not be select from the database!!!!
i can't understand how the lazy="true" runs....
thank a lot!
|