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 <matthew.broadh...@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 > > <matthew.broadh...@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 > >>> <matthew.broadh...@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