Set FetchMode in criteria does not work

Description

Setting the FetchMode different from the FetchType in the annotated classes is not working when the session is closed already.

When FetchType is LAZY in the annotated classes and Fetchmode in the criteria is set to JOIN the resultset performs an error. even if the Fetchmode JOIN should also receive the information from the other class linked to the first one:
Hibernate exception !failed to lazily initialize a collection of role: annotations.Company.employees, could not initialize proxy - no Session

The other way around:
When FetchType is EAGER in the annotated classes and Fetchmode in the criteria is set to LAZY the resultset contains also the data from the second table because of the EAGER FetchType in the classes. Setting the fechMode in the criteria is not working.

I added a Word document with some tests I did. In addition I added the source files to redo the test. Read the hibernate.cfg.xml file to see which database you need to create first.
DBName = dbhibernateFetchTypeJoin

when accesing the resultset after the session has been committed.

Environment

Java 1.7
Windows 8

Assignee

Unassigned

Reporter

Manfred Schlindwein

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure