Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 16091 invoked from network); 3 Feb 2010 17:20:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Feb 2010 17:20:35 -0000 Received: (qmail 46222 invoked by uid 500); 3 Feb 2010 17:20:35 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 46205 invoked by uid 500); 3 Feb 2010 17:20:35 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 46195 invoked by uid 99); 3 Feb 2010 17:20:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 17:20:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of msabo@buk.cvut.cz designates 147.32.104.6 as permitted sender) Received: from [147.32.104.6] (HELO sekvoj.buk.cvut.cz) (147.32.104.6) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2010 17:20:26 +0000 Received: from localhost (localhost [127.0.0.1]) by sekvoj.buk.cvut.cz (Postfix) with ESMTP id 4B5309B681 for ; Wed, 3 Feb 2010 18:20:05 +0100 (CET) Received: from sekvoj.buk.cvut.cz ([127.0.0.1]) by localhost (mail.buk.cvut.cz [127.0.0.1]) (amavisd-maia, port 10024) with LMTP id 25358-03 for ; Wed, 3 Feb 2010 18:20:00 +0100 (CET) Received: from [147.32.105.22] (antioch.buk.cvut.cz [147.32.105.22]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by sekvoj.buk.cvut.cz (Postfix) with ESMTPS id CAED69B670 for ; Wed, 3 Feb 2010 18:20:00 +0100 (CET) Message-ID: <4B69B040.3080504@buk.cvut.cz> Date: Wed, 03 Feb 2010 18:20:00 +0100 From: =?UTF-8?B?TWFyZWsgxaBhYm8=?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1 MIME-Version: 1.0 To: user@cayenne.apache.org Subject: Re: String-with-number sort and insert order preservation References: <4B68C71C.8030007@buk.cvut.cz> <4B69665A.1030109@buk.cvut.cz> <3219fff71002030444i17a366fbheb88d1a23fb5bc0d@mail.gmail.com> In-Reply-To: <3219fff71002030444i17a366fbheb88d1a23fb5bc0d@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard X-Virus-Checked: Checked by ClamAV on apache.org Hi, again thanks for answers, I will do for now pretty much what Andrey suggested - do subsequent commits as this is "one-time" operation and when the network will grow I will again populute the range in db (no more than 10k hosts) @Ari - yeah I overlooked this when you said it first time, but as I've already said, this table is mere list/enumeration for now and needs to be populated once per db lifetime Cheers, -- Marek Šabo On 02/03/2010 01:44 PM, Andrey Razumovsky wrote: > Actually, no. If you need to index data by IP, you just add indexing by IP > column. If you want to perform in future meaningful sort by meaningless IP, > you will have to think about such cases as changes the IP column - then the > order might break. Answering your question, if you really think you need > control over PK values, you either use custom PKs (and generate them > yourself), or, if the speed isn't priority, do many sequent commits instead > of one (if the logic of your app allows you) > > 2010/2/3 Marek Šabo > > >> Thank you all for your ideas, my progress: >> >> >> >> 1) Is there any way to sort varchar fields which happen to numbers, more >> >>> precisely ipv4s? >>> query.addOrdering(Ip4Address.IP_ADDRESS_PROPERTY, SortOrder.ASCENDING); >>> This of course sets the hundreds as first in line, any tips on some >>> custom sorting? >>> >>> >>> >> I just implemented custom comparator and added the result list from query >> to treeset - anyway the IPs are unique. >> >> >>> 2) Is there any way how to override this mechanism in order to preserve >>> order of inserted rows? >>> >>> >>> >>> >> This one I can't really cope with. Of course I could fill it in ten other >> ways which will preserve the order of inserted rows, so really, haven't any >> of you ever needed or wanted the data to be indexed by auto-generated pk in >> order you add them to context while in persisting phase? Because that would >> nicely solve issue #1 as well because the IPs would be sorted according to >> pk. This is collateral functionality that's why it isn't designed as OOP >> would preach. >> >> Regards, >> >> Marek >> >> > > >