|[eclipselink-users] Lazying-loaidng and Collection.size()|
Hi, What does the JPA standard (and alternatively EclipseLink) say about Lazy Loading and Collection/Set/List.size()? If the collection hasn't been initialized yet, does size() simply invoke a count(*) query or does it retrieve the entire collection including its elements? I'm thinking of the following use-case: 1) int size = myList.size(); 2) Object randomElement = myList.get((int) (Math.random() * size)); What is guaranteed to happen under the hood according to JPA and according to EclipseLink? Ideally I want to pass a Collection around my API, instead of forcing it to be Query-aware and issue SQL statements explicitly. Thank you, Gili -- View this message in context: http://www.nabble.com/Lazying-loaidng-and-Collection.size%28%29-tp19581000p19581000.html Sent from the EclipseLink - Users mailing list archive at Nabble.com.
Back to the top