Emmanuel Bernard That is not really the use case. Sorry I should have been more clear. The use case for which this is useful for Search is when you go to load entities based on lucene hits - so you have the ids to load. For an example, say a full-text search for Product returns ids [1,2,3,4,5]. So search asks ORM to "multi load" those Products. Now zero-or-more of those Products may already be associated with the Session. For the sake of this example, let's say Product#4 is already associated with the Session. So when ORM goes to build the SELECT query it needs to know how to handle that Product#4 is already associated with the Session. It's default behavior enableSessionCheck==false is to simply include id=4 in the selection. enableSessionCheck==true would cause it to "see" that Product#4 is already associated with the Session and not include it in the selection. There is a tipping point where one would be more efficient than the other. But that information is outside the scope of ORM. This is one of those 50/50 settings, which to me I personally need to see some overwhelming evidence that we should "flip". |