snd297 / penn-ppod

Automatically exported from code.google.com/p/penn-ppod
Apache License 2.0
0 stars 0 forks source link

Indexes not created in (at least) MySQL #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a fresh pPOD database.

What is the expected output? What do you see instead?

Should see indexes created on UUPPodEntity, Party, User, and Role.

Indexes only seem to be created if a column is declared as unique.

Original issue reported on code.google.com by snd...@gmail.com on 18 Nov 2009 at 9:16

GoogleCodeExporter commented 9 years ago

Original comment by snd...@gmail.com on 18 Nov 2009 at 9:18

GoogleCodeExporter commented 9 years ago
For example in Matrx, this one: 

@Entity
@Table(name = Matrix.TABLE)
@org.hibernate.annotations.Table(appliesTo = Matrix.TABLE, indexes = {
@org.hibernate.annotations.Index(name = "IDX_ID_LABEL", columnNames = {
        Matrix.ID_COLUMN, Matrix.LABEL_COLUMN }) })
public class Matrix implements IPPodVersionInfoable'

and this one:

    /** The label for this <code>Matrix</code>. */
    @Column(name = LABEL_COLUMN, nullable = false)
    @org.hibernate.annotations.Index(name = "IDX_" + LABEL_COLUMN)
    private String label;

It looks like if you set this columns to unique 

    @Column(name = LABEL_COLUMN, nullable = false)
    @Index(name = "IDX_" + LABEL_COLUMN)
    private String label;

it will make the index. 

But I still haven't been able to get this one to create, even w/ uniqueness of
both columns
@org.hibernate.annotations.Table(appliesTo = Matrix.TABLE, indexes = {
@Index(name = "IDX_ID_LABEL", columnNames = {
        "PPOD_ID", Matrix.LABEL_COLUMN }) })
______
Does MySQL support non-unique indexes

Original comment by snd...@gmail.com on 28 Jan 2010 at 8:31

GoogleCodeExporter commented 9 years ago
This looks relevant: 

From https://www.hibernate.org/119.html

The hibernate.hbm2ddl.auto=update setting doesn't create indexes
SchemaUpdate is activated by this configuration setting. SchemaUpdate is not 
really 
very powerful and comes without any warranties. For example, it does not create 
any 
indexes automatically. Furthermore, SchemaUpdate is only useful in development, 
per definition (a production schema is never updated automatically). You don't 
need 
indexes in development.

Hibernate doesn't generate the database indexes I want in the schema!
Automatic schema export (and update) by Hibernate tools is only useful in 
development. You never need indexes in development, they are purely for 
performance and scalability tuning in production systems. Production schemas 
are 
never automatically generated, at least not completely. A DBA adds indexes to 
the 
automatically generated schema during SQL tuning and testing of the 
application, 
before going into production with the (possibly automatically generated) base 
schema, and her handwritten optimized DDL. Also note that optimized DDL is 
highly 
vendor specific and totally dependent on the environment (SQL execution plans, 
tablespace configuration, caches, etc). Even if Hibernate developers would 
encourage 
you to automatically generate production-ready schemas (we don't, and we also 
don't like ad-hoc SQL tuning by throwing a bunch of indexes onto a schema), 
Hibernate could never offer such a feature.

Original comment by snd...@gmail.com on 4 Feb 2010 at 4:47

GoogleCodeExporter commented 9 years ago

Original comment by snd...@gmail.com on 10 Feb 2010 at 8:30

GoogleCodeExporter commented 9 years ago
 http://code.google.com/p/penn-ppod/issues/detail?id=1#c3 sums it up.

Original comment by snd...@gmail.com on 25 Mar 2010 at 3:52