KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > cfg > annotations > SetBinder


1 package org.hibernate.cfg.annotations;
2
3 import org.hibernate.mapping.Collection;
4 import org.hibernate.mapping.PersistentClass;
5 import org.hibernate.annotations.OrderBy;
6 import org.hibernate.cfg.Environment;
7 import org.apache.commons.logging.Log;
8 import org.apache.commons.logging.LogFactory;
9
10 /**
11  * Bind a set.
12  *
13  * @author Matthew Inger
14  */

15 public class SetBinder extends CollectionBinder {
16     private static Log log = LogFactory.getLog(SetBinder.class);
17
18     public SetBinder() {}
19
20     public SetBinder(boolean sorted) { super(sorted); }
21
22     protected Collection createCollection(PersistentClass persistentClass) {
23         return new org.hibernate.mapping.Set(persistentClass);
24     }
25
26     public void setSqlOrderBy(OrderBy orderByAnn) {
27         if (orderByAnn != null) {
28             if ( Environment.jvmSupportsLinkedHashCollections() ) {
29                 super.setSqlOrderBy(orderByAnn);
30             }
31             else {
32                 log.warn( "Attribute \"order-by\" ignored in JDK1.3 or less" );
33             }
34         }
35     }
36 }
37
Popular Tags