7 Replies Latest reply on Sep 28, 2008 1:15 AM by vk101

    List vs Set for entity collections?

      Do you use Lists or Sets for collection properties on your entities?

      In the majority of cases, I need Set functionality because the collection shouldn't contain duplicates, but using Sets gives me a lot of trouble when trying to display these elements in dataTables, even though I wrap the Set into a List using a custom EL expression in Facelets. The troubles include issues with sorting/paginating - have you experienced the same when dealing with a List-wrapped Set?

      I could have List wrappers for all Set collections in my entities, but this just seems messy (and I think would be the same result as doing the wrapping in the Facelets EL expression - right?).

      How should you represent your entity collections when Set semantics are the most appropriate for your domain model, and dataTables with sorting/paginating capabilities are a requirement?