Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » User defined (custom) collections
icon5.gif  User defined (custom) collections [message #508040] Fri, 15 January 2010 11:15 Go to next message
Eclipse UserFriend
Does EcilpseLink (or more generally, JPA) support custom collection types? I'm not talking about what is IN the collection, but the actual collection implementation itself. Can I create a specialized java.util.Set or java.util.Map in my object model and have the EntityManager use my own collection implementation for the relationships?

Thanks.
Re: User defined (custom) collections [message #508359 is a reply to message #508040] Mon, 18 January 2010 09:44 Go to previous messageGo to next message
Eclipse UserFriend
The JPA spec requires usage of List, Set, Collection or Map. EclipseLink requires usage of the interface is using LAZY, but allows an implementation that implements one of these interfaces if using EAGER.

If the variable type is an interface, you can assign any impl to it you want, but when EclipseLink builds an object from the database, it will put a special LAZY collection as the value.

See also,
http://en.wikibooks.org/wiki/Java_Persistence/Relationships# Collection_Implementations
Re: User defined (custom) collections [message #509942 is a reply to message #508359] Mon, 25 January 2010 15:25 Go to previous messageGo to next message
Eclipse UserFriend
OK, so can we implement our own LAZY collection implementation for EclipseLink and configure it to use that for certain relationships? Or is this the latest feature request? Laughing
Re: User defined (custom) collections [message #510746 is a reply to message #508040] Thu, 28 January 2010 09:32 Go to previous message
Eclipse UserFriend
If you wish to implement your own lazy collection you could do so.

Refer to the classes IndirectSet and IndirectMap to get an idea of how to do this. You will also need to set the ContainerPolicy on your mapping to your new collection type using a DescriptorCustomizer.

If you think you new indirect collection would be useful to other users, please feel free to contribute it back to the EclipseLink community.
Previous Topic:Problem with indirect (lazy) mappings
Next Topic:2.0.0: where did the commit go?
Goto Forum:
  


Current Time: Wed Jul 23 15:31:57 EDT 2025

Powered by FUDForum. Page generated in 0.03461 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top