Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping
In directory sc8-pr-cvs1:/tmp/cvs-serv18728
Modified Files:
Bag.java Collection.java List.java Value.java
Added Files:
IdentifierBag.java IdentifierCollection.java
Log Message:
added idbag and made some cleanups to collection fwk
--- NEW FILE: IdentifierBag.java ---
//$Id: IdentifierBag.java,v 1.1 2003/05/02 09:16:14 oneovthafew Exp $
package net.sf.hibernate.mapping;
import net.sf.hibernate.type.PersistentCollectionType;
import net.sf.hibernate.type.TypeFactory;
/**
* An <tt>IdentifierBag</tt> has a primary key consisting of just
* the identifier column
*/
public class IdentifierBag extends IdentifierCollection {
public IdentifierBag(PersistentClass owner) {
super(owner);
}
public PersistentCollectionType getType() {
return TypeFactory.idbag( getRole() );
}
public Class wrapperClass() {
return net.sf.hibernate.collection.IdentifierBag.class;
}
}
--- NEW FILE: IdentifierCollection.java ---
//$Id: IdentifierCollection.java,v 1.1 2003/05/02 09:16:14 oneovthafew Exp $
package net.sf.hibernate.mapping;
import java.util.Iterator;
/**
* A collection with a synthetic "identifier" column
*/
public abstract class IdentifierCollection extends Collection {
public static final String DEFAULT_IDENTIFIER_COLUMN_NAME = "id";
private Value identifier;
public IdentifierCollection(PersistentClass owner) {
super(owner);
}
public Value getIdentifier() {
return identifier;
}
public void setIdentifier(Value index) {
this.identifier = index;
}
public final boolean isIdentified() {
return true;
}
public void createPrimaryKey() {
PrimaryKey pk = new PrimaryKey();
Iterator iter = getIdentifier().getColumnIterator();
while ( iter.hasNext() ) {
pk.addColumn( (Column) iter.next() );
}
getTable().setPrimaryKey(pk);
}
}
Index: Bag.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Bag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Bag.java 27 Jan 2003 12:12:41 -0000 1.5
--- Bag.java 2 May 2003 09:16:13 -0000 1.6
***************
*** 10,17 ****
public class Bag extends Collection {
- /**
- * Constructor for Bag.
- * @param owner
- */
public Bag(PersistentClass owner) {
super(owner);
--- 10,13 ----
Index: Collection.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Collection.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Collection.java 15 Feb 2003 01:00:55 -0000 1.13
--- Collection.java 2 May 2003 09:16:14 -0000 1.14
***************
*** 229,232 ****
--- 229,236 ----
}
+ public boolean isIdentified() {
+ return false;
+ }
+
}
Index: List.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/List.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** List.java 27 Jan 2003 12:12:41 -0000 1.6
--- List.java 2 May 2003 09:16:14 -0000 1.7
***************
*** 11,18 ****
public class List extends IndexedCollection {
- /**
- * Constructor for List.
- * @param owner
- */
public List(PersistentClass owner) {
super(owner);
--- 11,14 ----
Index: Value.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Value.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Value.java 29 Mar 2003 04:08:47 -0000 1.10
--- Value.java 2 May 2003 09:16:14 -0000 1.11
***************
*** 101,108 ****
}
- public String getIdentifierStrategy() {
- return identifierGeneratorStrategy;
- }
-
public Properties getIdentifierGeneratorProperties() {
return identifierGeneratorProperties;
--- 101,104 ----
|