* BAEL-4723 Defining Indexes in JPA * unit -> integration test * whitespaces fix * tab to space Co-authored-by: mateusz.szablak <mateusz.szablak@accenture.com>
This commit is contained in:
parent
f440cf900c
commit
ad30d29ed6
@ -10,13 +10,13 @@ import java.util.Objects;
|
|||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(indexes = {
|
@Table(indexes = {
|
||||||
@Index(columnList = "firstName"),
|
@Index(columnList = "firstName"),
|
||||||
@Index(name = "fn_index", columnList = "id"),
|
@Index(name = "fn_index", columnList = "id"),
|
||||||
@Index(name = "multiIndex1", columnList = "firstName, lastName"),
|
@Index(name = "multiIndex1", columnList = "firstName, lastName"),
|
||||||
@Index(name = "multiIndex2", columnList = "lastName, firstName"),
|
@Index(name = "multiIndex2", columnList = "lastName, firstName"),
|
||||||
@Index(name = "multiSortIndex", columnList = "firstName, lastName DESC"),
|
@Index(name = "multiSortIndex", columnList = "firstName, lastName DESC"),
|
||||||
@Index(name = "uniqueIndex", columnList = "firstName", unique = true),
|
@Index(name = "uniqueIndex", columnList = "firstName", unique = true),
|
||||||
@Index(name = "uniqueMultiIndex", columnList = "firstName, lastName", unique = true)
|
@Index(name = "uniqueMultiIndex", columnList = "firstName, lastName", unique = true)
|
||||||
})
|
})
|
||||||
public class Student implements Serializable {
|
public class Student implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
|
@ -41,18 +41,18 @@
|
|||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
<persistence-unit name="jpa-index">
|
<persistence-unit name="jpa-index">
|
||||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
<class>com.baeldung.jpa.index.Student</class>
|
<class>com.baeldung.jpa.index.Student</class>
|
||||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
<properties>
|
<properties>
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
|
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
|
||||||
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test" />
|
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test" />
|
||||||
<property name="javax.persistence.jdbc.user" value="sa" />
|
<property name="javax.persistence.jdbc.user" value="sa" />
|
||||||
<property name="javax.persistence.jdbc.password" value="" />
|
<property name="javax.persistence.jdbc.password" value="" />
|
||||||
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
|
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
|
||||||
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
|
||||||
<property name="show_sql" value="true" />
|
<property name="show_sql" value="true" />
|
||||||
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
|
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
</persistence>
|
</persistence>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user