|
From: <one...@us...> - 2003-01-27 12:12:45
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping
In directory sc8-pr-cvs1:/tmp/cvs-serv24603/sf/hibernate/mapping
Modified Files:
Array.java Bag.java Collection.java IndexedCollection.java
List.java Map.java PersistentClass.java PrimitiveArray.java
Set.java Subclass.java Value.java
Removed Files:
Root.java
Log Message:
further clean-ups of mapping package
Index: Array.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Array.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Array.java 27 Jan 2003 07:12:03 -0000 1.6
--- Array.java 27 Jan 2003 12:12:40 -0000 1.7
***************
*** 5,8 ****
--- 5,12 ----
import net.sf.hibernate.type.TypeFactory;
+ /**
+ * An array has a primary key consisting of
+ * the key columns + index column.
+ */
public class Array extends List {
Index: Bag.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Bag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Bag.java 27 Jan 2003 07:12:03 -0000 1.4
--- Bag.java 27 Jan 2003 12:12:41 -0000 1.5
***************
*** 5,8 ****
--- 5,11 ----
import net.sf.hibernate.type.TypeFactory;
+ /**
+ * A bag permits duplicates, so it has no primary key
+ */
public class Bag extends Collection {
***************
*** 23,30 ****
}
- public void createPrimaryKey() {
- //do nothing .. bags have no PK
- }
-
}
--- 26,29 ----
Index: Collection.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Collection.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Collection.java 27 Jan 2003 07:12:03 -0000 1.10
--- Collection.java 27 Jan 2003 12:12:41 -0000 1.11
***************
*** 5,10 ****
import java.util.Iterator;
- import org.w3c.dom.Node;
-
import net.sf.hibernate.cache.CacheConcurrencyStrategy;
import net.sf.hibernate.type.PersistentCollectionType;
--- 5,8 ----
***************
*** 26,35 ****
private String orderBy;
private PersistentClass owner;
-
- //TODO: remove these ugly instance vars
- public Node node;
- public Root root;
- public boolean doneSecondPass;
-
private boolean sorted;
private Comparator comparator;
--- 24,27 ----
***************
*** 105,109 ****
return index;
}
! public abstract void createPrimaryKey();
public CacheConcurrencyStrategy getCache() {
--- 97,101 ----
return index;
}
! // public abstract void createPrimaryKey();
public CacheConcurrencyStrategy getCache() {
Index: IndexedCollection.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/IndexedCollection.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** IndexedCollection.java 27 Jan 2003 07:12:03 -0000 1.5
--- IndexedCollection.java 27 Jan 2003 12:12:41 -0000 1.6
***************
*** 4,7 ****
--- 4,11 ----
import java.util.Iterator;
+ /**
+ * Indexed collections include Lists, Maps, arrays and
+ * primitive arrays.
+ */
public abstract class IndexedCollection extends Collection {
Index: List.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/List.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** List.java 27 Jan 2003 07:12:03 -0000 1.5
--- List.java 27 Jan 2003 12:12:41 -0000 1.6
***************
*** 5,8 ****
--- 5,12 ----
import net.sf.hibernate.type.TypeFactory;
+ /**
+ * A list has a primary key consisting of
+ * the key columns + index column.
+ */
public class List extends IndexedCollection {
Index: Map.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Map.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Map.java 27 Jan 2003 07:12:03 -0000 1.8
--- Map.java 27 Jan 2003 12:12:41 -0000 1.9
***************
*** 5,8 ****
--- 5,12 ----
import net.sf.hibernate.type.TypeFactory;
+ /**
+ * A map has a primary key consisting of
+ * the key columns + index columns.
+ */
public class Map extends IndexedCollection {
Index: PersistentClass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/PersistentClass.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PersistentClass.java 27 Jan 2003 07:12:03 -0000 1.8
--- PersistentClass.java 27 Jan 2003 12:12:41 -0000 1.9
***************
*** 7,10 ****
--- 7,11 ----
import net.sf.hibernate.cache.CacheConcurrencyStrategy;
import net.sf.hibernate.util.JoinedIterator;
+ import net.sf.hibernate.util.StringHelper;
public abstract class PersistentClass {
***************
*** 152,155 ****
--- 153,169 ----
public void setProxyInterface(Class proxyInterface) {
this.proxyInterface = proxyInterface;
+ }
+
+ public void createPrimaryKey() {
+ //Primary key constraint
+ PrimaryKey pk = new PrimaryKey();
+ pk.setTable(table);
+ pk.setName( StringHelper.suffix( table.getName(), "PK" ) );
+ table.setPrimaryKey(pk);
+
+ Iterator iter = getKey().getColumnIterator();
+ while ( iter.hasNext() ) {
+ pk.addColumn( (Column) iter.next() );
+ }
}
Index: PrimitiveArray.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/PrimitiveArray.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PrimitiveArray.java 27 Jan 2003 07:12:03 -0000 1.5
--- PrimitiveArray.java 27 Jan 2003 12:12:41 -0000 1.6
***************
*** 2,5 ****
--- 2,9 ----
package net.sf.hibernate.mapping;
+ /**
+ * A primitive array has a primary key consisting
+ * of the key columns + index column.
+ */
public class PrimitiveArray extends Array {
Index: Set.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Set.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Set.java 27 Jan 2003 07:12:03 -0000 1.4
--- Set.java 27 Jan 2003 12:12:41 -0000 1.5
***************
*** 7,11 ****
import net.sf.hibernate.type.TypeFactory;
!
public class Set extends Collection {
--- 7,15 ----
import net.sf.hibernate.type.TypeFactory;
! /**
! * A set with no nullable element columns will have a primary
! * key consisting of all table columns (ie. key columns +
! * element columns).
! */
public class Set extends Collection {
***************
*** 23,31 ****
public PersistentCollectionType getType() {
! return isSorted() ? TypeFactory.sortedSet( getRole(), getComparator() ) : TypeFactory.set( getRole() );
}
public Class wrapperClass() {
! return isSorted() ? net.sf.hibernate.collection.SortedSet.class : net.sf.hibernate.collection.Set.class;
}
--- 27,39 ----
public PersistentCollectionType getType() {
! return isSorted() ?
! TypeFactory.sortedSet( getRole(), getComparator() ) :
! TypeFactory.set( getRole() );
}
public Class wrapperClass() {
! return isSorted() ?
! net.sf.hibernate.collection.SortedSet.class :
! net.sf.hibernate.collection.Set.class;
}
Index: Subclass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Subclass.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Subclass.java 27 Jan 2003 07:12:03 -0000 1.8
--- Subclass.java 27 Jan 2003 12:12:41 -0000 1.9
***************
*** 10,19 ****
public class Subclass extends PersistentClass {
public Subclass(PersistentClass superclass) {
this.superclass = superclass;
}
-
- private PersistentClass superclass;
- private Value key;
public CacheConcurrencyStrategy getCache() {
--- 10,19 ----
public class Subclass extends PersistentClass {
+ private PersistentClass superclass;
+ private Value key;
+
public Subclass(PersistentClass superclass) {
this.superclass = superclass;
}
public CacheConcurrencyStrategy getCache() {
Index: Value.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Value.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Value.java 27 Jan 2003 07:12:03 -0000 1.7
--- Value.java 27 Jan 2003 12:12:41 -0000 1.8
***************
*** 15,18 ****
--- 15,24 ----
import net.sf.hibernate.util.ReflectHelper;
+ /**
+ * A value represents a simple thing that maps down to
+ * a table column or columns. Higher level things like
+ * classes, properties and collections add semantics
+ * to instances of this class.
+ */
public class Value {
//TODO: split this class into two - one that handles collections, and a second that handles basic types
--- Root.java DELETED ---
|