Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: David Lamb Newsgroups: comp.lang.java.programmer Subject: Re: How to store and represent 1 objects relationship to other objects Date: Mon, 29 Oct 2012 10:12:54 -0400 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: <23786bb4-22cc-4711-a172-8e5c7ce5375e@googlegroups.com> <7ae71496-be19-497a-b856-7333d3b4adf7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 29 Oct 2012 14:12:52 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="7f42270a997e580902d19031af10867c"; logging-data="18280"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Hke1nE1zGIO3Pn14fNa9n" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 In-Reply-To: Cancel-Lock: sha1:pEiadQ70qzaKvB0Gx4+UQlcrKVQ= Xref: csiph.com comp.lang.java.programmer:19554 On 28/10/2012 11:47 PM, Gene Wirchenko wrote: > On Fri, 26 Oct 2012 14:51:49 -0700 (PDT), Lew > wrote: > > [snip] > >> If you further wish to guarantee that no 'LineItem' appears more than once, you'd likely use a 'Set' >> instead of a 'List'. Unfortunately the JPA spec doesn't seem to allow 'SortedSet', but it seems that >> the '@OrderBy' annotation hacks around that limitation. > > Sets (in the mathematical sense) do not have order. If you want > to have an order, use a list. Mathematically he's looking for an injective sequence -- one where there is an order but where no element occurs more than once. It's neither a simple list nor a simple set, so I'm not surprised that there's some sort of of "@OrderedSet" annotation grafted onto a conventional data structure.