From users-return-12206-archive-asf-public=cust-asf.ponee.io@openjpa.apache.org Sat Mar 2 13:05:59 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BFD7318064A for ; Sat, 2 Mar 2019 14:05:58 +0100 (CET) Received: (qmail 83970 invoked by uid 500); 2 Mar 2019 13:05:57 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 83958 invoked by uid 99); 2 Mar 2019 13:05:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Mar 2019 13:05:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C3C41181738 for ; Sat, 2 Mar 2019 13:05:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.048 X-Spam-Level: X-Spam-Status: No, score=0.048 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id KjFx5NIVrdHi for ; Sat, 2 Mar 2019 13:05:55 +0000 (UTC) Received: from mail-it1-f195.google.com (mail-it1-f195.google.com [209.85.166.195]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 860165F417 for ; Sat, 2 Mar 2019 13:05:54 +0000 (UTC) Received: by mail-it1-f195.google.com with SMTP id g17so1050744ita.2 for ; Sat, 02 Mar 2019 05:05:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=Y+n59o4ge9dLIkTuw+MDVsw+f8UUa+HNxd79zvP1nK0=; b=BFHcUttxm2VCFNyDaeltHQ9w9KBuXEt4R+eqAC2EqZ5oT5Vlky/GBO4q/aV7prYhKF 00uO6J3+2DihJFwOLqGxRUiQO5V11IWrRaQClNt+Gve6R49GHemsIVnKIWpY7qO6iiJ7 plyDOj3Y/hOXlINfa0MvaIfGb5cb6CEWcDQ1hbKdBHf8XtKcIjq1KNHP40e4rKazRUIo jCUqLKqD+M4oB6oPIL58aCmMAO2ByAVBac7lsc82QsCfGeHgyHlNOKJ+w2kBjGancFym NfAn+PS8DKeW5IwC/KFCA+m5ekqxEOUXNHaLenLWi9MmgSae68MD6Uho+1wBaMB9koE4 r6sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=Y+n59o4ge9dLIkTuw+MDVsw+f8UUa+HNxd79zvP1nK0=; b=MmuvtmDzbATyDy1DKX1U+ireoCXLzmO0oh6+lp/EWcbCXL+T3Sw7drTv9BleIpxOr4 r49K6fXSYpbkYb1OUpOyKACaEG632oFmNDbWfM/t4tEcsvSz9XWrSScEpRMe1/TgTAj4 zKvlQ2eTCW6FrfLeAyD9CBGM7h8eAKHz8+PGiFnZOTRVTJ2GhMJya27CTn6RHubDoigJ /0hE6LY7RqUUm7d6/bgbZrjpZskwAgIL3vND5qRiQoOeKvWVtVKJHJXjQ6ziwK8kqZcu 6hKyBnSnvzW4H2uFofvOfQx4vAjI26wR9Wc9Yez2TD92Ebe9M+8+uhzq9W4d+bpWY40p cLMQ== X-Gm-Message-State: APjAAAUjZCotjT9emDLNIdc9FdOLxs72E+zVXepB9NuZeYEagS+hMba8 0b2xOza93BNbRfrKZOPOT5Et6sfXv29PjcpgHDoQixTS X-Google-Smtp-Source: APXvYqy3qNh0Ce2Hr/2QNXwT5ysNd3cHhU52H1/IM1qYY+JrgmT+vXb7nArDTfzHm5zhIh8nJbmh8GFQ6GW+d3VOe7A= X-Received: by 2002:a05:660c:b44:: with SMTP id m4mr5685383itl.132.1551531952975; Sat, 02 Mar 2019 05:05:52 -0800 (PST) MIME-Version: 1.0 References: <441a4fdc-5805-f205-f2c3-f926dec72a4f@nbmlaw.co.uk> <03d4f4b4-5f8d-0ba5-1d67-df734f1ac27b@nbmlaw.co.uk> <447c35d2-90d2-e7a1-344e-7d9988b155e0@nbmlaw.co.uk> <499398899.5190181.1546456321379@mail.yahoo.com> <66d2ac98-af13-fecf-ed04-e17a4a8dd039@nbmlaw.co.uk> In-Reply-To: <66d2ac98-af13-fecf-ed04-e17a4a8dd039@nbmlaw.co.uk> From: Maxim Solodovnik Date: Sat, 2 Mar 2019 20:05:41 +0700 Message-ID: Subject: Re: openjpa indexes To: users@openjpa.apache.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Matthew, Maybe you can build openjpa from branch 'javax-index' locally and check if the fix works for you as expected? On Sat, 2 Mar 2019 at 19:33, Matthew Broadhead wrote: > > Thanks, I am glad you are looking into the issue. I don't really know > much about the internals of OpenJpa. The code you created looks sensible > > On 01/03/2019 11:41, Maxim Solodovnik wrote: > > I have created JIRA to track the status: > > https://issues.apache.org/jira/browse/OPENJPA-2777 > > Will try to add some tests and will ask for review/verification :) > > > > On Tue, 26 Feb 2019 at 09:15, Maxim Solodovnik w= rote: > >> I have started work on this > >> > >> Could you please take a look? Is it the step in right direction? > >> https://github.com/apache/openjpa/compare/javax-index?expand=3D1 > >> > >> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik = wrote: > >>> Additional suspicious annotations are: > >>> > >>> org.apache.openjpa.persistence.jdbc.Unique ( vs. > >>> javax.persistence.UniqueConstraint) > >>> org.apache.openjpa.persistence.jdbc.ForeignKey ( vs. > >>> javax.persistence.ForeignKey) > >>> > >>> maybe some more > >>> Maybe it worth to be dropped and replaced with annotations from > >>> javax.persistence.* ? > >>> > >>> On Mon, 25 Feb 2019 at 22:10, Maxim Solodovnik = wrote: > >>>> Hello All, > >>>> > >>>> I'm still debugging the code trying to understand what is going on i= n the code > >>>> It seems indices are being created for foreign keys only > >>>> > >>>> Can it be caused by the fact OpenJPA still has it's own annotation f= or > >>>> indices org.apache.openjpa.persistence.jdbc.Index ? > >>>> > >>>> Will try to debug also `DBDictionary#getCreateIndexSQL` > >>>> > >>>> On Thu, 3 Jan 2019 at 02:12, Mark Struberg wrote: > >>>>> The generator happens in the MappingTool. This is the top-level.P= robably the best guess is to set a breakpoint in DBDictionary#getCreateInd= exSQLThe DBDictionary (and it's respecive subclasses) is where all the adop= ting to different databases happens. > >>>>> LieGrue,strub > >>>>> > >>>>> On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <= solomax666@gmail.com> wrote: > >>>>> > >>>>> Unfortunately I was unable to find where this magic happens :( > >>>>> can someone from devs can point me to the right direction? > >>>>> > >>>>> On Sat, 15 Dec 2018 at 16:58, Matthew Broadhead > >>>>> wrote: > >>>>> > >>>>>> i am using mysql > >>>>>> > >>>>>> On 15/12/2018 09:35, Maxim Solodovnik wrote: > >>>>>>> Indicies seems to be auto-created on > >>>>>>> @Id, @PrimaryKeyJoinColumn and @JoinColumn > >>>>>>> > >>>>>>> just have tested with MySql DB Index seems not being created > >>>>>>> will try to debug > >>>>>>> > >>>>>>> > >>>>>>> On Thu, 13 Dec 2018 at 23:33, Matthew Broadhead > >>>>>>> wrote: > >>>>>>> > >>>>>>>> i saw a similar example but was hoping the index could be automa= tically > >>>>>>>> created. some indexes are automatically created but seeingly no= t > >>>>>> others. > >>>>>>>> i tried the annotations as in the example and the index is never > >>>>>>>> created. here is what i have added to my class > >>>>>>>> @Entity > >>>>>>>> @Table(name =3D "billentry", indexes =3D { > >>>>>>>> @Index(name =3D "I_BLLNTRY_SECTION", columnList =3D > >>>>>>>> "BILLSECTION_ID", unique =3D false), > >>>>>>>> @Index(name =3D "I_BLLNTRY_BILLTEMPLATEENTRY", columnL= ist =3D > >>>>>>>> "btentryid", unique =3D false) }) > >>>>>>>> public class BillEntry implements Serializable { > >>>>>>>> private static final long serialVersionUID =3D 1L; > >>>>>>>> > >>>>>>>> @Id > >>>>>>>> @GeneratedValue(strategy =3D GenerationType.IDENTITY) > >>>>>>>> private Long id; > >>>>>>>> > >>>>>>>> @Version > >>>>>>>> private Long version; > >>>>>>>> > >>>>>>>> @ManyToOne > >>>>>>>> private BillSection billSection; > >>>>>>>> > >>>>>>>> @ManyToOne > >>>>>>>> @Column(name =3D "btentryid") > >>>>>>>> private BillTemplateEntry billTemplateEntry; > >>>>>>>> > >>>>>>>> On 12/12/2018 02:34, Maxim Solodovnik wrote: > >>>>>>>>> This might help for the latest OpenJpa (it should have partial = 2.1 > >>>>>>>>> compatibility) > >>>>>>>>> https://stackoverflow.com/a/22658951/3571661 > >>>>>>>>> > >>>>>>>>> On Wed, 12 Dec 2018 at 01:17, Matthew Broadhead > >>>>>>>>> wrote: > >>>>>>>>> > >>>>>>>>>> recently had an application running slowly and had to manually= add an > >>>>>>>>>> index. but openjpa seemed to create all the other indexes > >>>>>>>> automatically. > >>>>>>>>>> my structure was like > >>>>>>>>>> Bill > >>>>>>>>>> has a collection of > >>>>>>>>>> BillMoney > >>>>>>>>>> has a collection of > >>>>>>>>>> BillSection > >>>>>>>>>> has a collection of > >>>>>>>>>> BillEntry > >>>>>>>>>> > >>>>>>>>>> BillMoney was automatically created with index I_BLLMONY_BILL = which > >>>>>>>>>> related to the Bill id > >>>>>>>>>> BillSection was automatically created with index I_BLLSCTN_BIL= LMONEY > >>>>>>>>>> which related to the BillMoney section > >>>>>>>>>> But BillEntry did not have an index. > >>>>>>>>>> > >>>>>>>>>> BillEntry was a pre existing table so could that have somethin= g to do > >>>>>>>>>> with it? is there any way to force indexes to be created? > >>>>>>>>>> > >>>>>> > >>>>> -- > >>>>> WBR > >>>>> Maxim aka solomax > >>>>> > >>>> > >>>> > >>>> -- > >>>> WBR > >>>> Maxim aka solomax > >>> > >>> > >>> -- > >>> WBR > >>> Maxim aka solomax > >> > >> > >> -- > >> WBR > >> Maxim aka solomax > > > > > --=20 WBR Maxim aka solomax