|(no subject) [message #689994]
||Tue, 28 June 2011 13:31
Registered: July 2009
JPA requires that you use the collection interfaces Collection, List, Set or Map to allow the JPA provider to provide optimizations just as LAZY loading. It should not matter what type of Set it is, just use the Set interface. If you really want a HashSet for some specific purpose, you can define a getFooAsHashSet method that returns new HashSet(this.foo).|
If you use EAGER, then by default EclipseLink will allow you to use an implementation class, but this is not possible with LAZY. EclipseLink will use an instance of IndirectSet (which contains a HashSet) for any LAZY field, this does not mean the set has not been read, just that it has the potential to be LAZY.
In general in Java it is best to use the collection interfaces in your code.
Why do you want a HashSet?
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Powered by FUDForum
. Page generated in 0.01601 seconds