Make my own web site - 130 CHAPTER 6 n MAPPING WITH ANNOTATIONS CHAPTER
130 CHAPTER 6 n MAPPING WITH ANNOTATIONS CHAPTER 6 n MAPPING WITH ANNOTATIONS from the annotations, the column is assumed to be an integertype, but this can be overridden by supplying a columnDefinitionattribute specifying a different column definition string. Applying Indexes with @Table and @Index The Hibernate-specific @Table annotation supplements the standard table annotation and allows additional index hints to be provided to Hibernate. These will be used at schema generation time to apply indexes to the columns specified. The following code gives an example. // Standard persistence annotations: @javax.persistence.Entity @javax.persistence.Table(name=”FOO”) // Hibernate-specific table annotation: @Table( appliesTo=”FOO”, indexes = { @Index(name=”FOO_FROM_TO_IDX”,columnNames={”FIRST”,”LAST”}), @Index(name=”FOO_EMPLOYEE_IDX”,columnNames={”EMPLOYEE_NUM”})) public class Foo { … } Restricting Collections with @Where The contents of a collection that will be retrieved from the database can be restricted with a Hibernate-specific @Where annotation. This simply adds a Where clause to the query that will be used to obtain the entities contained within the collection. Here s an example: @javax.persistence.OneToMany @org.hibernate.annotations.Where(clause=”grade > 2″) public Set
Note: In case you are looking for affordable webhost to host and run your web application check Vision cheap hosting services