You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Mark Struberg <st...@yahoo.de.INVALID> on 2019/01/02 19:12:01 UTC

Re: openjpa indexes

 The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
LieGrue,strub

    On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
<ma...@nbmlaw.co.uk.invalid> 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
> > <ma...@nbmlaw.co.uk.invalid> wrote:
> >
> >> i saw a similar example but was hoping the index could be automatically
> >> created.  some indexes are automatically created but seeingly not
> 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 = "billentry", indexes = {
> >>          @Index(name = "I_BLLNTRY_SECTION", columnList =
> >> "BILLSECTION_ID", unique = false),
> >>          @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> >> "btentryid", unique = false) })
> >> public class BillEntry implements Serializable {
> >>      private static final long serialVersionUID = 1L;
> >>
> >>      @Id
> >>      @GeneratedValue(strategy = GenerationType.IDENTITY)
> >>      private Long id;
> >>
> >>      @Version
> >>      private Long version;
> >>
> >>      @ManyToOne
> >>      private BillSection billSection;
> >>
> >>      @ManyToOne
> >>      @Column(name = "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
> >>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> >>>> which related to the BillMoney section
> >>>> But BillEntry did not have an index.
> >>>>
> >>>> BillEntry was a pre existing table so could that have something to do
> >>>> with it?  is there any way to force indexes to be created?
> >>>>
> >>
>
>

-- 
WBR
Maxim aka solomax
  

Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
Fixed!
Thanks a lot!

On Sun, 3 Mar 2019 at 14:22, Romain Manni-Bucau <rm...@gmail.com> wrote:
>
> Hi Maxim,
>
> I'm not sure about error messages - expected new ones but properties were
> not modified from what I saw in the diff - but looks ok to me except that
> detail.
>
> Le dim. 3 mars 2019 à 03:09, Maxim Solodovnik <so...@gmail.com> a
> écrit :
>
> > @Devs,
> >
> > could you please take a look at my PR:
> > https://github.com/apache/openjpa/pull/39
> >
> > On Sat, 2 Mar 2019 at 20:05, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> > >
> > > 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
> > > <ma...@nbmlaw.co.uk.invalid> 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 <so...@gmail.com>
> > wrote:
> > > > >> 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=1
> > > > >>
> > > > >> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <
> > solomax666@gmail.com> 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 <
> > solomax666@gmail.com> wrote:
> > > > >>>> Hello All,
> > > > >>>>
> > > > >>>> I'm still debugging the code trying to understand what is going
> > on in 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 for
> > > > >>>> indices org.apache.openjpa.persistence.jdbc.Index ?
> > > > >>>>
> > > > >>>> Will try to debug also `DBDictionary#getCreateIndexSQL`
> > > > >>>>
> > > > >>>> On Thu, 3 Jan 2019 at 02:12, Mark Struberg
> > <st...@yahoo.de.invalid> wrote:
> > > > >>>>>   The generator happens in the MappingTool. This is the
> > top-level.Probably the best guess is to set a breakpoint in
> > DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive
> > subclasses) is where all the adopting to different databases happens.
> > > > >>>>> LieGrue,strub
> > > > >>>>>
> > > > >>>>>      On Tuesday, 18 December 2018, 03:53:51 CET, Maxim
> > Solodovnik <so...@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
> > > > >>>>> <ma...@nbmlaw.co.uk.invalid> 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
> > > > >>>>>>> <ma...@nbmlaw.co.uk.invalid> wrote:
> > > > >>>>>>>
> > > > >>>>>>>> i saw a similar example but was hoping the index could be
> > automatically
> > > > >>>>>>>> created.  some indexes are automatically created but seeingly
> > not
> > > > >>>>>> 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 = "billentry", indexes = {
> > > > >>>>>>>>           @Index(name = "I_BLLNTRY_SECTION", columnList =
> > > > >>>>>>>> "BILLSECTION_ID", unique = false),
> > > > >>>>>>>>           @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY",
> > columnList =
> > > > >>>>>>>> "btentryid", unique = false) })
> > > > >>>>>>>> public class BillEntry implements Serializable {
> > > > >>>>>>>>       private static final long serialVersionUID = 1L;
> > > > >>>>>>>>
> > > > >>>>>>>>       @Id
> > > > >>>>>>>>       @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > > >>>>>>>>       private Long id;
> > > > >>>>>>>>
> > > > >>>>>>>>       @Version
> > > > >>>>>>>>       private Long version;
> > > > >>>>>>>>
> > > > >>>>>>>>       @ManyToOne
> > > > >>>>>>>>       private BillSection billSection;
> > > > >>>>>>>>
> > > > >>>>>>>>       @ManyToOne
> > > > >>>>>>>>       @Column(name = "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
> > > > >>>>>>>>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > > > >>>>>>>>>> which related to the BillMoney section
> > > > >>>>>>>>>> But BillEntry did not have an index.
> > > > >>>>>>>>>>
> > > > >>>>>>>>>> BillEntry was a pre existing table so could that have
> > something 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
> > > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >



-- 
WBR
Maxim aka solomax

Re: openjpa indexes

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Maxim,

I'm not sure about error messages - expected new ones but properties were
not modified from what I saw in the diff - but looks ok to me except that
detail.

Le dim. 3 mars 2019 à 03:09, Maxim Solodovnik <so...@gmail.com> a
écrit :

> @Devs,
>
> could you please take a look at my PR:
> https://github.com/apache/openjpa/pull/39
>
> On Sat, 2 Mar 2019 at 20:05, Maxim Solodovnik <so...@gmail.com>
> wrote:
> >
> > 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
> > <ma...@nbmlaw.co.uk.invalid> 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 <so...@gmail.com>
> wrote:
> > > >> 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=1
> > > >>
> > > >> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <
> solomax666@gmail.com> 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 <
> solomax666@gmail.com> wrote:
> > > >>>> Hello All,
> > > >>>>
> > > >>>> I'm still debugging the code trying to understand what is going
> on in 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 for
> > > >>>> indices org.apache.openjpa.persistence.jdbc.Index ?
> > > >>>>
> > > >>>> Will try to debug also `DBDictionary#getCreateIndexSQL`
> > > >>>>
> > > >>>> On Thu, 3 Jan 2019 at 02:12, Mark Struberg
> <st...@yahoo.de.invalid> wrote:
> > > >>>>>   The generator happens in the MappingTool. This is the
> top-level.Probably the best guess is to set a breakpoint in
> DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive
> subclasses) is where all the adopting to different databases happens.
> > > >>>>> LieGrue,strub
> > > >>>>>
> > > >>>>>      On Tuesday, 18 December 2018, 03:53:51 CET, Maxim
> Solodovnik <so...@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
> > > >>>>> <ma...@nbmlaw.co.uk.invalid> 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
> > > >>>>>>> <ma...@nbmlaw.co.uk.invalid> wrote:
> > > >>>>>>>
> > > >>>>>>>> i saw a similar example but was hoping the index could be
> automatically
> > > >>>>>>>> created.  some indexes are automatically created but seeingly
> not
> > > >>>>>> 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 = "billentry", indexes = {
> > > >>>>>>>>           @Index(name = "I_BLLNTRY_SECTION", columnList =
> > > >>>>>>>> "BILLSECTION_ID", unique = false),
> > > >>>>>>>>           @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY",
> columnList =
> > > >>>>>>>> "btentryid", unique = false) })
> > > >>>>>>>> public class BillEntry implements Serializable {
> > > >>>>>>>>       private static final long serialVersionUID = 1L;
> > > >>>>>>>>
> > > >>>>>>>>       @Id
> > > >>>>>>>>       @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > >>>>>>>>       private Long id;
> > > >>>>>>>>
> > > >>>>>>>>       @Version
> > > >>>>>>>>       private Long version;
> > > >>>>>>>>
> > > >>>>>>>>       @ManyToOne
> > > >>>>>>>>       private BillSection billSection;
> > > >>>>>>>>
> > > >>>>>>>>       @ManyToOne
> > > >>>>>>>>       @Column(name = "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
> > > >>>>>>>>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > > >>>>>>>>>> which related to the BillMoney section
> > > >>>>>>>>>> But BillEntry did not have an index.
> > > >>>>>>>>>>
> > > >>>>>>>>>> BillEntry was a pre existing table so could that have
> something 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
> > > >
> > > >
> > >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
>
>
>
> --
> WBR
> Maxim aka solomax
>

Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
@Devs,

could you please take a look at my PR: https://github.com/apache/openjpa/pull/39

On Sat, 2 Mar 2019 at 20:05, Maxim Solodovnik <so...@gmail.com> wrote:
>
> 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
> <ma...@nbmlaw.co.uk.invalid> 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 <so...@gmail.com> wrote:
> > >> 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=1
> > >>
> > >> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <so...@gmail.com> 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 <so...@gmail.com> wrote:
> > >>>> Hello All,
> > >>>>
> > >>>> I'm still debugging the code trying to understand what is going on in 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 for
> > >>>> indices org.apache.openjpa.persistence.jdbc.Index ?
> > >>>>
> > >>>> Will try to debug also `DBDictionary#getCreateIndexSQL`
> > >>>>
> > >>>> On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
> > >>>>>   The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
> > >>>>> LieGrue,strub
> > >>>>>
> > >>>>>      On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
> > >>>>> <ma...@nbmlaw.co.uk.invalid> 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
> > >>>>>>> <ma...@nbmlaw.co.uk.invalid> wrote:
> > >>>>>>>
> > >>>>>>>> i saw a similar example but was hoping the index could be automatically
> > >>>>>>>> created.  some indexes are automatically created but seeingly not
> > >>>>>> 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 = "billentry", indexes = {
> > >>>>>>>>           @Index(name = "I_BLLNTRY_SECTION", columnList =
> > >>>>>>>> "BILLSECTION_ID", unique = false),
> > >>>>>>>>           @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> > >>>>>>>> "btentryid", unique = false) })
> > >>>>>>>> public class BillEntry implements Serializable {
> > >>>>>>>>       private static final long serialVersionUID = 1L;
> > >>>>>>>>
> > >>>>>>>>       @Id
> > >>>>>>>>       @GeneratedValue(strategy = GenerationType.IDENTITY)
> > >>>>>>>>       private Long id;
> > >>>>>>>>
> > >>>>>>>>       @Version
> > >>>>>>>>       private Long version;
> > >>>>>>>>
> > >>>>>>>>       @ManyToOne
> > >>>>>>>>       private BillSection billSection;
> > >>>>>>>>
> > >>>>>>>>       @ManyToOne
> > >>>>>>>>       @Column(name = "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
> > >>>>>>>>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > >>>>>>>>>> which related to the BillMoney section
> > >>>>>>>>>> But BillEntry did not have an index.
> > >>>>>>>>>>
> > >>>>>>>>>> BillEntry was a pre existing table so could that have something 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
> > >
> > >
> >
>
>
> --
> WBR
> Maxim aka solomax



-- 
WBR
Maxim aka solomax

Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
@Devs,

could you please take a look at my PR: https://github.com/apache/openjpa/pull/39

On Sat, 2 Mar 2019 at 20:05, Maxim Solodovnik <so...@gmail.com> wrote:
>
> 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
> <ma...@nbmlaw.co.uk.invalid> 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 <so...@gmail.com> wrote:
> > >> 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=1
> > >>
> > >> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <so...@gmail.com> 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 <so...@gmail.com> wrote:
> > >>>> Hello All,
> > >>>>
> > >>>> I'm still debugging the code trying to understand what is going on in 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 for
> > >>>> indices org.apache.openjpa.persistence.jdbc.Index ?
> > >>>>
> > >>>> Will try to debug also `DBDictionary#getCreateIndexSQL`
> > >>>>
> > >>>> On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
> > >>>>>   The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
> > >>>>> LieGrue,strub
> > >>>>>
> > >>>>>      On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
> > >>>>> <ma...@nbmlaw.co.uk.invalid> 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
> > >>>>>>> <ma...@nbmlaw.co.uk.invalid> wrote:
> > >>>>>>>
> > >>>>>>>> i saw a similar example but was hoping the index could be automatically
> > >>>>>>>> created.  some indexes are automatically created but seeingly not
> > >>>>>> 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 = "billentry", indexes = {
> > >>>>>>>>           @Index(name = "I_BLLNTRY_SECTION", columnList =
> > >>>>>>>> "BILLSECTION_ID", unique = false),
> > >>>>>>>>           @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> > >>>>>>>> "btentryid", unique = false) })
> > >>>>>>>> public class BillEntry implements Serializable {
> > >>>>>>>>       private static final long serialVersionUID = 1L;
> > >>>>>>>>
> > >>>>>>>>       @Id
> > >>>>>>>>       @GeneratedValue(strategy = GenerationType.IDENTITY)
> > >>>>>>>>       private Long id;
> > >>>>>>>>
> > >>>>>>>>       @Version
> > >>>>>>>>       private Long version;
> > >>>>>>>>
> > >>>>>>>>       @ManyToOne
> > >>>>>>>>       private BillSection billSection;
> > >>>>>>>>
> > >>>>>>>>       @ManyToOne
> > >>>>>>>>       @Column(name = "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
> > >>>>>>>>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > >>>>>>>>>> which related to the BillMoney section
> > >>>>>>>>>> But BillEntry did not have an index.
> > >>>>>>>>>>
> > >>>>>>>>>> BillEntry was a pre existing table so could that have something 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
> > >
> > >
> >
>
>
> --
> WBR
> Maxim aka solomax



-- 
WBR
Maxim aka solomax

Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
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
<ma...@nbmlaw.co.uk.invalid> 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 <so...@gmail.com> wrote:
> >> 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=1
> >>
> >> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <so...@gmail.com> 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 <so...@gmail.com> wrote:
> >>>> Hello All,
> >>>>
> >>>> I'm still debugging the code trying to understand what is going on in 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 for
> >>>> indices org.apache.openjpa.persistence.jdbc.Index ?
> >>>>
> >>>> Will try to debug also `DBDictionary#getCreateIndexSQL`
> >>>>
> >>>> On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
> >>>>>   The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
> >>>>> LieGrue,strub
> >>>>>
> >>>>>      On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
> >>>>> <ma...@nbmlaw.co.uk.invalid> 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
> >>>>>>> <ma...@nbmlaw.co.uk.invalid> wrote:
> >>>>>>>
> >>>>>>>> i saw a similar example but was hoping the index could be automatically
> >>>>>>>> created.  some indexes are automatically created but seeingly not
> >>>>>> 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 = "billentry", indexes = {
> >>>>>>>>           @Index(name = "I_BLLNTRY_SECTION", columnList =
> >>>>>>>> "BILLSECTION_ID", unique = false),
> >>>>>>>>           @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> >>>>>>>> "btentryid", unique = false) })
> >>>>>>>> public class BillEntry implements Serializable {
> >>>>>>>>       private static final long serialVersionUID = 1L;
> >>>>>>>>
> >>>>>>>>       @Id
> >>>>>>>>       @GeneratedValue(strategy = GenerationType.IDENTITY)
> >>>>>>>>       private Long id;
> >>>>>>>>
> >>>>>>>>       @Version
> >>>>>>>>       private Long version;
> >>>>>>>>
> >>>>>>>>       @ManyToOne
> >>>>>>>>       private BillSection billSection;
> >>>>>>>>
> >>>>>>>>       @ManyToOne
> >>>>>>>>       @Column(name = "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
> >>>>>>>>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> >>>>>>>>>> which related to the BillMoney section
> >>>>>>>>>> But BillEntry did not have an index.
> >>>>>>>>>>
> >>>>>>>>>> BillEntry was a pre existing table so could that have something 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
> >
> >
>


-- 
WBR
Maxim aka solomax

Re: openjpa indexes

Posted by Matthew Broadhead <ma...@nbmlaw.co.uk.INVALID>.
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 <so...@gmail.com> wrote:
>> 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=1
>>
>> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <so...@gmail.com> 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 <so...@gmail.com> wrote:
>>>> Hello All,
>>>>
>>>> I'm still debugging the code trying to understand what is going on in 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 for
>>>> indices org.apache.openjpa.persistence.jdbc.Index ?
>>>>
>>>> Will try to debug also `DBDictionary#getCreateIndexSQL`
>>>>
>>>> On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
>>>>>   The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
>>>>> LieGrue,strub
>>>>>
>>>>>      On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
>>>>> <ma...@nbmlaw.co.uk.invalid> 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
>>>>>>> <ma...@nbmlaw.co.uk.invalid> wrote:
>>>>>>>
>>>>>>>> i saw a similar example but was hoping the index could be automatically
>>>>>>>> created.  some indexes are automatically created but seeingly not
>>>>>> 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 = "billentry", indexes = {
>>>>>>>>           @Index(name = "I_BLLNTRY_SECTION", columnList =
>>>>>>>> "BILLSECTION_ID", unique = false),
>>>>>>>>           @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
>>>>>>>> "btentryid", unique = false) })
>>>>>>>> public class BillEntry implements Serializable {
>>>>>>>>       private static final long serialVersionUID = 1L;
>>>>>>>>
>>>>>>>>       @Id
>>>>>>>>       @GeneratedValue(strategy = GenerationType.IDENTITY)
>>>>>>>>       private Long id;
>>>>>>>>
>>>>>>>>       @Version
>>>>>>>>       private Long version;
>>>>>>>>
>>>>>>>>       @ManyToOne
>>>>>>>>       private BillSection billSection;
>>>>>>>>
>>>>>>>>       @ManyToOne
>>>>>>>>       @Column(name = "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
>>>>>>>>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
>>>>>>>>>> which related to the BillMoney section
>>>>>>>>>> But BillEntry did not have an index.
>>>>>>>>>>
>>>>>>>>>> BillEntry was a pre existing table so could that have something 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
>
>


Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
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 <so...@gmail.com> wrote:
>
> 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=1
>
> On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <so...@gmail.com> 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 <so...@gmail.com> wrote:
> > >
> > > Hello All,
> > >
> > > I'm still debugging the code trying to understand what is going on in 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 for
> > > indices org.apache.openjpa.persistence.jdbc.Index ?
> > >
> > > Will try to debug also `DBDictionary#getCreateIndexSQL`
> > >
> > > On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
> > > >
> > > >  The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
> > > > LieGrue,strub
> > > >
> > > >     On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
> > > > <ma...@nbmlaw.co.uk.invalid> 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
> > > > > > <ma...@nbmlaw.co.uk.invalid> wrote:
> > > > > >
> > > > > >> i saw a similar example but was hoping the index could be automatically
> > > > > >> created.  some indexes are automatically created but seeingly not
> > > > > 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 = "billentry", indexes = {
> > > > > >>          @Index(name = "I_BLLNTRY_SECTION", columnList =
> > > > > >> "BILLSECTION_ID", unique = false),
> > > > > >>          @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> > > > > >> "btentryid", unique = false) })
> > > > > >> public class BillEntry implements Serializable {
> > > > > >>      private static final long serialVersionUID = 1L;
> > > > > >>
> > > > > >>      @Id
> > > > > >>      @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > > > >>      private Long id;
> > > > > >>
> > > > > >>      @Version
> > > > > >>      private Long version;
> > > > > >>
> > > > > >>      @ManyToOne
> > > > > >>      private BillSection billSection;
> > > > > >>
> > > > > >>      @ManyToOne
> > > > > >>      @Column(name = "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
> > > > > >>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > > > > >>>> which related to the BillMoney section
> > > > > >>>> But BillEntry did not have an index.
> > > > > >>>>
> > > > > >>>> BillEntry was a pre existing table so could that have something 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



-- 
WBR
Maxim aka solomax

Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
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=1

On Mon, 25 Feb 2019 at 22:26, Maxim Solodovnik <so...@gmail.com> 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 <so...@gmail.com> wrote:
> >
> > Hello All,
> >
> > I'm still debugging the code trying to understand what is going on in 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 for
> > indices org.apache.openjpa.persistence.jdbc.Index ?
> >
> > Will try to debug also `DBDictionary#getCreateIndexSQL`
> >
> > On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
> > >
> > >  The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
> > > LieGrue,strub
> > >
> > >     On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
> > > <ma...@nbmlaw.co.uk.invalid> 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
> > > > > <ma...@nbmlaw.co.uk.invalid> wrote:
> > > > >
> > > > >> i saw a similar example but was hoping the index could be automatically
> > > > >> created.  some indexes are automatically created but seeingly not
> > > > 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 = "billentry", indexes = {
> > > > >>          @Index(name = "I_BLLNTRY_SECTION", columnList =
> > > > >> "BILLSECTION_ID", unique = false),
> > > > >>          @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> > > > >> "btentryid", unique = false) })
> > > > >> public class BillEntry implements Serializable {
> > > > >>      private static final long serialVersionUID = 1L;
> > > > >>
> > > > >>      @Id
> > > > >>      @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > > >>      private Long id;
> > > > >>
> > > > >>      @Version
> > > > >>      private Long version;
> > > > >>
> > > > >>      @ManyToOne
> > > > >>      private BillSection billSection;
> > > > >>
> > > > >>      @ManyToOne
> > > > >>      @Column(name = "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
> > > > >>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > > > >>>> which related to the BillMoney section
> > > > >>>> But BillEntry did not have an index.
> > > > >>>>
> > > > >>>> BillEntry was a pre existing table so could that have something 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

Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
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 <so...@gmail.com> wrote:
>
> Hello All,
>
> I'm still debugging the code trying to understand what is going on in 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 for
> indices org.apache.openjpa.persistence.jdbc.Index ?
>
> Will try to debug also `DBDictionary#getCreateIndexSQL`
>
> On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
> >
> >  The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
> > LieGrue,strub
> >
> >     On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
> > <ma...@nbmlaw.co.uk.invalid> 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
> > > > <ma...@nbmlaw.co.uk.invalid> wrote:
> > > >
> > > >> i saw a similar example but was hoping the index could be automatically
> > > >> created.  some indexes are automatically created but seeingly not
> > > 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 = "billentry", indexes = {
> > > >>          @Index(name = "I_BLLNTRY_SECTION", columnList =
> > > >> "BILLSECTION_ID", unique = false),
> > > >>          @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> > > >> "btentryid", unique = false) })
> > > >> public class BillEntry implements Serializable {
> > > >>      private static final long serialVersionUID = 1L;
> > > >>
> > > >>      @Id
> > > >>      @GeneratedValue(strategy = GenerationType.IDENTITY)
> > > >>      private Long id;
> > > >>
> > > >>      @Version
> > > >>      private Long version;
> > > >>
> > > >>      @ManyToOne
> > > >>      private BillSection billSection;
> > > >>
> > > >>      @ManyToOne
> > > >>      @Column(name = "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
> > > >>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > > >>>> which related to the BillMoney section
> > > >>>> But BillEntry did not have an index.
> > > >>>>
> > > >>>> BillEntry was a pre existing table so could that have something 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

Re: openjpa indexes

Posted by Maxim Solodovnik <so...@gmail.com>.
Hello All,

I'm still debugging the code trying to understand what is going on in 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 for
indices org.apache.openjpa.persistence.jdbc.Index ?

Will try to debug also `DBDictionary#getCreateIndexSQL`

On Thu, 3 Jan 2019 at 02:12, Mark Struberg <st...@yahoo.de.invalid> wrote:
>
>  The generator happens in the MappingTool. This is the top-level.Probably the best guess is to set a breakpoint in  DBDictionary#getCreateIndexSQLThe DBDictionary (and it's respecive subclasses) is where all the adopting to different databases happens.
> LieGrue,strub
>
>     On Tuesday, 18 December 2018, 03:53:51 CET, Maxim Solodovnik <so...@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
> <ma...@nbmlaw.co.uk.invalid> 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
> > > <ma...@nbmlaw.co.uk.invalid> wrote:
> > >
> > >> i saw a similar example but was hoping the index could be automatically
> > >> created.  some indexes are automatically created but seeingly not
> > 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 = "billentry", indexes = {
> > >>          @Index(name = "I_BLLNTRY_SECTION", columnList =
> > >> "BILLSECTION_ID", unique = false),
> > >>          @Index(name = "I_BLLNTRY_BILLTEMPLATEENTRY", columnList =
> > >> "btentryid", unique = false) })
> > >> public class BillEntry implements Serializable {
> > >>      private static final long serialVersionUID = 1L;
> > >>
> > >>      @Id
> > >>      @GeneratedValue(strategy = GenerationType.IDENTITY)
> > >>      private Long id;
> > >>
> > >>      @Version
> > >>      private Long version;
> > >>
> > >>      @ManyToOne
> > >>      private BillSection billSection;
> > >>
> > >>      @ManyToOne
> > >>      @Column(name = "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
> > >>> <ma...@nbmlaw.co.uk.invalid> 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_BILLMONEY
> > >>>> which related to the BillMoney section
> > >>>> But BillEntry did not have an index.
> > >>>>
> > >>>> BillEntry was a pre existing table so could that have something to do
> > >>>> with it?  is there any way to force indexes to be created?
> > >>>>
> > >>
> >
> >
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax