KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > mapping > Map


1 //$Id: Map.java,v 1.9 2005/02/20 03:34:49 oneovthafew Exp $
2
package org.hibernate.mapping;
3
4 import org.hibernate.MappingException;
5 import org.hibernate.type.CollectionType;
6 import org.hibernate.type.TypeFactory;
7
8 /**
9  * A map has a primary key consisting of
10  * the key columns + index columns.
11  */

12 public class Map extends IndexedCollection {
13
14     public Map(PersistentClass owner) {
15         super(owner);
16     }
17     
18     public boolean isMap() {
19         return true;
20     }
21
22     public CollectionType getDefaultCollectionType() {
23         return isSorted() ?
24             TypeFactory.sortedMap( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() ) :
25             TypeFactory.map( getRole(), getReferencedPropertyName(), isEmbedded() );
26     }
27
28
29     public void createAllKeys() throws MappingException {
30         super.createAllKeys();
31         if ( !isInverse() ) getIndex().createForeignKey();
32     }
33
34     public Object JavaDoc accept(ValueVisitor visitor) {
35         return visitor.accept(this);
36     }
37 }
38
Popular Tags