Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping
In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/mapping
Modified Files:
Array.java Association.java Bag.java Collection.java
Column.java Component.java Constraint.java ForeignKey.java
Index.java IndexedCollection.java IntegerValue.java List.java
ManyToOne.java Map.java OneToMany.java OneToOne.java
PersistentClass.java PrimaryKey.java PrimitiveArray.java
Property.java RelationalModel.java Root.java RootClass.java
Set.java Subclass.java Table.java UniqueKey.java Value.java
Log Message:
reformatted code with beautiful, shiny, happy TABS!
improved an exception
Index: Array.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Array.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Array.java 2 Jan 2003 11:01:49 -0000 1.2
--- Array.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 13,17 ****
private Class elementClass;
!
public Array(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
super(node, prefix, owner, root);
--- 13,17 ----
private Class elementClass;
!
public Array(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
super(node, prefix, owner, root);
***************
*** 51,57 ****
public Class getElementClass() {
! return elementClass;
}
!
public PersistentCollectionType getType() {
return TypeFactory.array( getRole(), getElementClass() );
--- 51,57 ----
public Class getElementClass() {
! return elementClass;
}
!
public PersistentCollectionType getType() {
return TypeFactory.array( getRole(), getElementClass() );
***************
*** 65,69 ****
return true;
}
!
}
--- 65,72 ----
return true;
}
!
}
+
+
+
Index: Association.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Association.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Association.java 2 Jan 2003 11:01:49 -0000 1.2
--- Association.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 11,15 ****
private final int joinedFetch;
!
private int initJoinedFetch(Node node) {
Node jfNode = node.getAttributes().getNamedItem("outer-join");
--- 11,15 ----
private final int joinedFetch;
!
private int initJoinedFetch(Node node) {
Node jfNode = node.getAttributes().getNamedItem("outer-join");
***************
*** 43,47 ****
public abstract void createForeignKeys(Root root, Table table);
!
}
--- 43,50 ----
public abstract void createForeignKeys(Root root, Table table);
!
}
+
+
+
Index: Bag.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Bag.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Bag.java 1 Jan 2003 13:56:13 -0000 1.1.1.1
--- Bag.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 9,25 ****
public class Bag extends Collection {
!
public Bag(Node node, String prefix, PersistentClass owner, Root root)
! throws MappingException {
super(node, prefix, owner, root);
}
!
public PersistentCollectionType getType() {
return TypeFactory.bag( getRole() );
}
!
public Class wrapperClass() {
return net.sf.hibernate.collection.Bag.class;
}
!
}
--- 9,28 ----
public class Bag extends Collection {
!
public Bag(Node node, String prefix, PersistentClass owner, Root root)
! throws MappingException {
super(node, prefix, owner, root);
}
!
public PersistentCollectionType getType() {
return TypeFactory.bag( getRole() );
}
!
public Class wrapperClass() {
return net.sf.hibernate.collection.Bag.class;
}
!
}
+
+
+
Index: Collection.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Collection.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Collection.java 3 Jan 2003 13:36:01 -0000 1.4
--- Collection.java 4 Jan 2003 11:15:29 -0000 1.5
***************
*** 103,110 ****
String tableName;
if (tableNode!=null) {
! tableName = tableNode.getNodeValue();
}
else {
! tableName = barerole;
}
Node schemaNode = atts.getNamedItem("schema");
--- 103,110 ----
String tableName;
if (tableNode!=null) {
! tableName = tableNode.getNodeValue();
}
else {
! tableName = barerole;
}
Node schemaNode = atts.getNamedItem("schema");
***************
*** 131,135 ****
table = persistentClass.getTable();
}
!
NodeList list = node.getChildNodes();
for ( int i=0; i<list.getLength(); i++ ) {
--- 131,135 ----
table = persistentClass.getTable();
}
!
NodeList list = node.getChildNodes();
for ( int i=0; i<list.getLength(); i++ ) {
***************
*** 147,151 ****
element = new Value(subnode, DEFAULT_ELEMENT_COLUMN_NAME, true, table, root);
}
! else if ( "many-to-many".equals(name) ) {
element = new ManyToOne(subnode, Root.ROOT_ROLE_NAME, DEFAULT_ELEMENT_COLUMN_NAME, true, table, root);
}
--- 147,151 ----
element = new Value(subnode, DEFAULT_ELEMENT_COLUMN_NAME, true, table, root);
}
! else if ( "many-to-many".equals(name) ) {
element = new ManyToOne(subnode, Root.ROOT_ROLE_NAME, DEFAULT_ELEMENT_COLUMN_NAME, true, table, root);
}
***************
*** 157,161 ****
}
}
!
if (!inverse) {
if (!isOneToMany) element.createForeignKeys(root, table);
--- 157,161 ----
}
}
!
if (!inverse) {
if (!isOneToMany) element.createForeignKeys(root, table);
***************
*** 165,170 ****
}
! if ( !isIndexed() ) createIndex();
!
doneSecondPass=true;
}
--- 165,170 ----
}
! if ( !isIndexed() ) createIndex();
!
doneSecondPass=true;
}
***************
*** 176,180 ****
this.lazy = lazy;
}
!
public String getRole() {
return role;
--- 176,180 ----
this.lazy = lazy;
}
!
public String getRole() {
return role;
***************
*** 188,196 ****
return false;
}
!
public boolean isArray() {
return false;
}
!
public boolean isOneToMany() {
return isOneToMany;
--- 188,196 ----
return false;
}
!
public boolean isArray() {
return false;
}
!
public boolean isOneToMany() {
return isOneToMany;
***************
*** 201,208 ****
}
public Index createIndex() {
! String name = "IX" + table.uniqueColumnString( getKey().getColumnIterator() );
! Index index = table.getIndex(name);
Iterator iter = getKey().getColumnIterator();
! while ( iter.hasNext() ) index.addColumn( (Column) iter.next() );
return index;
}
--- 201,208 ----
}
public Index createIndex() {
! String name = "IX" + table.uniqueColumnString( getKey().getColumnIterator() );
! Index index = table.getIndex(name);
Iterator iter = getKey().getColumnIterator();
! while ( iter.hasNext() ) index.addColumn( (Column) iter.next() );
return index;
}
***************
*** 214,218 ****
return cache;
}
!
public boolean isInverse() {
return inverse;
--- 214,218 ----
return cache;
}
!
public boolean isInverse() {
return inverse;
***************
*** 222,226 ****
return owner.getPersistentClass();
}
!
}
--- 222,229 ----
return owner.getPersistentClass();
}
!
}
+
+
+
Index: Column.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Column.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Column.java 1 Jan 2003 13:56:14 -0000 1.1.1.1
--- Column.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 40,44 ****
this.name = name;
}
!
public boolean isNullable() {
return nullable;
--- 40,44 ----
this.name = name;
}
!
public boolean isNullable() {
return nullable;
***************
*** 65,69 ****
sqlType = (typeNode==null) ? null : typeNode.getNodeValue();
}
!
public int getTypeIndex() {
return typeIndex;
--- 65,69 ----
sqlType = (typeNode==null) ? null : typeNode.getNodeValue();
}
!
public int getTypeIndex() {
return typeIndex;
***************
*** 72,76 ****
this.typeIndex = typeIndex;
}
!
public int getSQLType(Mapping pi) throws MappingException {
try {
--- 72,76 ----
this.typeIndex = typeIndex;
}
!
public int getSQLType(Mapping pi) throws MappingException {
try {
***************
*** 78,110 ****
}
catch (Exception e) {
! throw new MappingException(
! "Could not determine type for column " + name + " of type " + type.getClass().getName() + ": " + e.getClass().getName(),
! e
);
}
}
!
public boolean isUnique() {
return unique;
}
!
!
public String getSqlType(Dialect dialect, Mapping pi) throws HibernateException {
return (sqlType==null) ? dialect.getTypeName( getSQLType(pi), getLength() ) : sqlType;
}
- public boolean equals(Object object) {
- return object instanceof Column && equals( (Column) object );
- }
-
- public boolean equals(Column column) {
- if (null == column) return false;
- if (this == column) return true;
-
- return name.equals(column.name);
- }
- public int hashCode() {
- return name.hashCode();
- }
- }
\ No newline at end of file
--- 78,112 ----
}
catch (Exception e) {
! throw new MappingException(
! "Could not determine type for column " + name + " of type " + type.getClass().getName() + ": " + e.getClass().getName(),
! e
);
}
}
!
public boolean isUnique() {
return unique;
}
!
!
public String getSqlType(Dialect dialect, Mapping pi) throws HibernateException {
return (sqlType==null) ? dialect.getTypeName( getSQLType(pi), getLength() ) : sqlType;
}
+
+ public boolean equals(Object object) {
+ return object instanceof Column && equals( (Column) object );
+ }
+
+ public boolean equals(Column column) {
+ if (null == column) return false;
+ if (this == column) return true;
+
+ return name.equals(column.name);
+ }
+
+ public int hashCode() {
+ return name.hashCode();
+ }
+ }
Index: Component.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Component.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Component.java 2 Jan 2003 11:01:49 -0000 1.2
--- Component.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 81,85 ****
//component path
path += Root.ROLE_SEPERATOR + StringHelper.unqualify(className);
!
NodeList list = node.getChildNodes();
for ( int i=0; i<list.getLength(); i++ ) {
--- 81,85 ----
//component path
path += Root.ROLE_SEPERATOR + StringHelper.unqualify(className);
!
NodeList list = node.getChildNodes();
for ( int i=0; i<list.getLength(); i++ ) {
***************
*** 141,145 ****
setType( new net.sf.hibernate.type.ComponentType(componentClass, types, names, joinedFetch, cascade, parentProperty, embedded) );
}
!
public Class getComponentClass() {
return componentClass;
--- 141,145 ----
setType( new net.sf.hibernate.type.ComponentType(componentClass, types, names, joinedFetch, cascade, parentProperty, embedded) );
}
!
public Class getComponentClass() {
return componentClass;
***************
*** 151,159 ****
return embedded;
}
!
public boolean isComposite() {
return true;
}
!
}
--- 151,162 ----
return embedded;
}
!
public boolean isComposite() {
return true;
}
!
}
+
+
+
Index: Constraint.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Constraint.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Constraint.java 1 Jan 2003 13:56:15 -0000 1.1.1.1
--- Constraint.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 10,14 ****
private final ArrayList columns = new ArrayList();
private Table table;
!
public String getName() {
return name;
--- 10,14 ----
private final ArrayList columns = new ArrayList();
private Table table;
!
public String getName() {
return name;
***************
*** 21,25 ****
}
public void addColumn(Column column) {
! if ( !columns.contains(column) ) columns.add(column);
}
public int getColumnSpan() {
--- 21,25 ----
}
public void addColumn(Column column) {
! if ( !columns.contains(column) ) columns.add(column);
}
public int getColumnSpan() {
***************
*** 35,47 ****
this.table = table;
}
!
public String sqlDropString(Dialect dialect) {
return "alter table " + getTable().getQualifiedName() + " drop constraint " + getName();
}
!
public String sqlCreateString(Dialect dialect, Mapping p) {
StringBuffer buf = new StringBuffer("alter table ")
! .append( getTable().getQualifiedName() )
! .append( sqlConstraintString( dialect, getName() ) );
return buf.toString();
}
--- 35,47 ----
this.table = table;
}
!
public String sqlDropString(Dialect dialect) {
return "alter table " + getTable().getQualifiedName() + " drop constraint " + getName();
}
!
public String sqlCreateString(Dialect dialect, Mapping p) {
StringBuffer buf = new StringBuffer("alter table ")
! .append( getTable().getQualifiedName() )
! .append( sqlConstraintString( dialect, getName() ) );
return buf.toString();
}
***************
*** 49,51 ****
--- 49,54 ----
public abstract String sqlConstraintString(Dialect d, String constraintName);
}
+
+
+
Index: ForeignKey.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/ForeignKey.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ForeignKey.java 1 Jan 2003 13:56:15 -0000 1.1.1.1
--- ForeignKey.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 30,35 ****
}
public void setReferencedTable(Table referencedTable) throws MappingException {
! if ( referencedTable.getPrimaryKey().getColumnSpan()!=getColumnSpan() )
! throw new MappingException("Foreign key must have same number of columns as referenced primary key");
Iterator fkCols = getColumnIterator();
--- 30,35 ----
}
public void setReferencedTable(Table referencedTable) throws MappingException {
! if ( referencedTable.getPrimaryKey().getColumnSpan()!=getColumnSpan() )
! throw new MappingException("Foreign key must have same number of columns as referenced primary key");
Iterator fkCols = getColumnIterator();
***************
*** 41,45 ****
this.referencedTable = referencedTable;
}
!
public Class getReferencedClass() {
return referencedClass;
--- 41,45 ----
this.referencedTable = referencedTable;
}
!
public Class getReferencedClass() {
return referencedClass;
***************
*** 51,55 ****
public ForeignKey() {
}
!
}
--- 51,58 ----
public ForeignKey() {
}
!
}
+
+
+
Index: Index.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Index.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Index.java 1 Jan 2003 13:56:16 -0000 1.1.1.1
--- Index.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 10,24 ****
import net.sf.hibernate.dialect.Dialect;
! public class Index implements RelationalModel {
private Table table;
private ArrayList columns = new ArrayList();
private String name;
public String sqlCreateString(Dialect dialect, Mapping p)
! throws HibernateException {
StringBuffer buf = new StringBuffer("create index ")
! .append( dialect.qualifyIndexName() ? name : StringHelper.unqualify(name) )
! .append(" on ")
! .append( table.getQualifiedName() )
! .append(" (");
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
--- 10,24 ----
import net.sf.hibernate.dialect.Dialect;
! public class Index implements RelationalModel {
private Table table;
private ArrayList columns = new ArrayList();
private String name;
public String sqlCreateString(Dialect dialect, Mapping p)
! throws HibernateException {
StringBuffer buf = new StringBuffer("create index ")
! .append( dialect.qualifyIndexName() ? name : StringHelper.unqualify(name) )
! .append(" on ")
! .append( table.getQualifiedName() )
! .append(" (");
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
***************
*** 42,46 ****
}
public void addColumn(Column column) {
! if (!columns.contains(column)) columns.add(column);
}
public String getName() {
--- 42,46 ----
}
public void addColumn(Column column) {
! if (!columns.contains(column)) columns.add(column);
}
public String getName() {
***************
*** 51,52 ****
--- 51,55 ----
}
}
+
+
+
Index: IndexedCollection.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/IndexedCollection.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** IndexedCollection.java 1 Jan 2003 13:56:16 -0000 1.1.1.1
--- IndexedCollection.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 38,43 ****
getTable().setPrimaryKey(pk);
}
!
!
}
--- 38,46 ----
getTable().setPrimaryKey(pk);
}
!
!
}
+
+
+
Index: IntegerValue.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/IntegerValue.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IntegerValue.java 2 Jan 2003 11:01:49 -0000 1.2
--- IntegerValue.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 19,23 ****
col.setTypeIndex(0);
}
!
}
--- 19,26 ----
col.setTypeIndex(0);
}
!
}
+
+
+
Index: List.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/List.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** List.java 1 Jan 2003 13:56:16 -0000 1.1.1.1
--- List.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 10,14 ****
private boolean doneSecondPass;
!
public List(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
super(node, prefix, owner, root);
--- 10,14 ----
private boolean doneSecondPass;
!
public List(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
super(node, prefix, owner, root);
***************
*** 39,43 ****
return net.sf.hibernate.collection.List.class;
}
!
}
--- 39,46 ----
return net.sf.hibernate.collection.List.class;
}
!
}
+
+
+
Index: ManyToOne.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/ManyToOne.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ManyToOne.java 2 Jan 2003 11:01:49 -0000 1.2
--- ManyToOne.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 13,24 ****
public class ManyToOne extends Association {
!
// A many-to-one association
public ManyToOne(Node node, String path, String defaultColumnName, boolean isNullable, Table table, Root root) throws MappingException {
super(node, path, defaultColumnName, isNullable, table, root);
}
-
- protected Type typeFromXML(Node node) throws MappingException {
NamedNodeMap atts = node.getAttributes();
Node typeNode = atts.getNamedItem("class");
--- 13,24 ----
public class ManyToOne extends Association {
!
// A many-to-one association
public ManyToOne(Node node, String path, String defaultColumnName, boolean isNullable, Table table, Root root) throws MappingException {
super(node, path, defaultColumnName, isNullable, table, root);
}
+ protected Type typeFromXML(Node node) throws MappingException {
+
NamedNodeMap atts = node.getAttributes();
Node typeNode = atts.getNamedItem("class");
***************
*** 34,39 ****
public void setTypeByReflection(Class propertyClass, String propertyName) throws MappingException {
try {
! if (getType()==null) setType( TypeFactory.manyToOne(
! ReflectHelper.getGetter(propertyClass, propertyName).getReturnType()
) );
}
--- 34,39 ----
public void setTypeByReflection(Class propertyClass, String propertyName) throws MappingException {
try {
! if (getType()==null) setType( TypeFactory.manyToOne(
! ReflectHelper.getGetter(propertyClass, propertyName).getReturnType()
) );
}
***************
*** 42,50 ****
}
}
!
public void createForeignKeys(Root root, Table table) {
createForeignKeyOfClass(root, table, ( (EntityType) getType() ).getPersistentClass() );
}
!
}
--- 42,53 ----
}
}
!
public void createForeignKeys(Root root, Table table) {
createForeignKeyOfClass(root, table, ( (EntityType) getType() ).getPersistentClass() );
}
!
}
+
+
+
Index: Map.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Map.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Map.java 2 Jan 2003 11:01:49 -0000 1.3
--- Map.java 4 Jan 2003 11:15:29 -0000 1.4
***************
*** 12,16 ****
public class Map extends IndexedCollection {
!
private final boolean sorted;
private Comparator comparator;
--- 12,16 ----
public class Map extends IndexedCollection {
!
private final boolean sorted;
private Comparator comparator;
***************
*** 19,23 ****
public Map(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
super(node, prefix, owner, root);
!
Node sortedAtt = node.getAttributes().getNamedItem("sort");
--- 19,23 ----
public Map(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
super(node, prefix, owner, root);
!
Node sortedAtt = node.getAttributes().getNamedItem("sort");
***************
*** 67,79 ****
doneSecondPass = true;
}
!
public PersistentCollectionType getType() {
return sorted ? TypeFactory.sortedMap( getRole(), comparator ): TypeFactory.map( getRole() );
}
!
public Class wrapperClass() {
return sorted ? net.sf.hibernate.collection.SortedMap.class : net.sf.hibernate.collection.Map.class;
}
!
}
--- 67,82 ----
doneSecondPass = true;
}
!
public PersistentCollectionType getType() {
return sorted ? TypeFactory.sortedMap( getRole(), comparator ): TypeFactory.map( getRole() );
}
!
public Class wrapperClass() {
return sorted ? net.sf.hibernate.collection.SortedMap.class : net.sf.hibernate.collection.Map.class;
}
!
}
+
+
+
Index: OneToMany.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/OneToMany.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** OneToMany.java 1 Jan 2003 13:56:17 -0000 1.1.1.1
--- OneToMany.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 18,27 ****
return type;
}
!
public OneToMany(Node node, PersistentClass owner) throws MappingException {
this.referencingTable = (owner==null) ? null : owner.getTable();
try {
type = (EntityType) Hibernate.association( ReflectHelper.classForName(
! node.getAttributes().getNamedItem("class").getNodeValue()
) );
}
--- 18,27 ----
return type;
}
!
public OneToMany(Node node, PersistentClass owner) throws MappingException {
this.referencingTable = (owner==null) ? null : owner.getTable();
try {
type = (EntityType) Hibernate.association( ReflectHelper.classForName(
! node.getAttributes().getNamedItem("class").getNodeValue()
) );
}
***************
*** 30,37 ****
}
}
!
public Table getReferencingTable() {
return referencingTable;
}
}
--- 30,40 ----
}
}
!
public Table getReferencingTable() {
return referencingTable;
}
}
+
+
+
Index: OneToOne.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/OneToOne.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OneToOne.java 2 Jan 2003 11:01:49 -0000 1.2
--- OneToOne.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 21,25 ****
private AssociationType.ForeignKeyType foreignKeyType;
private Value identifier;
!
// A one-to-one association
public OneToOne(Node node, Value identifier, String path, boolean isNullable, Table table, Root root) throws MappingException {
--- 21,25 ----
private AssociationType.ForeignKeyType foreignKeyType;
private Value identifier;
!
// A one-to-one association
public OneToOne(Node node, Value identifier, String path, boolean isNullable, Table table, Root root) throws MappingException {
***************
*** 27,33 ****
this.identifier = identifier;
}
-
- protected Type typeFromXML(Node node) throws MappingException {
NamedNodeMap atts = node.getAttributes();
Node constrNode = atts.getNamedItem("constrained");
--- 27,33 ----
this.identifier = identifier;
}
+ protected Type typeFromXML(Node node) throws MappingException {
+
NamedNodeMap atts = node.getAttributes();
Node constrNode = atts.getNamedItem("constrained");
***************
*** 48,53 ****
public void setTypeByReflection(Class propertyClass, String propertyName) throws MappingException {
try {
! if (getType()==null) setType( TypeFactory.oneToOne(
! ReflectHelper.getGetter(propertyClass, propertyName).getReturnType(), foreignKeyType
) );
}
--- 48,53 ----
public void setTypeByReflection(Class propertyClass, String propertyName) throws MappingException {
try {
! if (getType()==null) setType( TypeFactory.oneToOne(
! ReflectHelper.getGetter(propertyClass, propertyName).getReturnType(), foreignKeyType
) );
}
***************
*** 59,63 ****
if (constrained) createForeignKeyOfClass( root, table, ( (EntityType) getType() ).getPersistentClass() );
}
!
public java.util.List getConstraintColumns() {
ArrayList list = new ArrayList();
--- 59,63 ----
if (constrained) createForeignKeyOfClass( root, table, ( (EntityType) getType() ).getPersistentClass() );
}
!
public java.util.List getConstraintColumns() {
ArrayList list = new ArrayList();
***************
*** 67,69 ****
--- 67,72 ----
}
}
+
+
+
Index: PersistentClass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/PersistentClass.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PersistentClass.java 2 Jan 2003 11:01:49 -0000 1.2
--- PersistentClass.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 20,24 ****
private final ArrayList subclassTables = new ArrayList();
private Class proxyInterface; //can be final
!
protected PersistentClass(Node node) throws MappingException {
NamedNodeMap atts = node.getAttributes();
--- 20,24 ----
private final ArrayList subclassTables = new ArrayList();
private Class proxyInterface; //can be final
!
protected PersistentClass(Node node) throws MappingException {
NamedNodeMap atts = node.getAttributes();
***************
*** 44,69 ****
Node discriminatorNode = atts.getNamedItem("discriminator-value");
discriminatorValue = (discriminatorNode==null) ? className : discriminatorNode.getNodeValue();
!
}
!
public String getDiscriminatorValue() {
return discriminatorValue;
}
!
protected void addSubclass(Subclass subclass) {
subclasses.add(subclass);
}
!
protected void propertiesFromXML(Node node, Root root) throws MappingException {
!
NodeList list = node.getChildNodes();
String path = StringHelper.unqualify(className);
Table table = getTable();
for ( int i=0; i<list.getLength(); i++ ) {
!
Node subnode = list.item(i);
String name = subnode.getNodeName();
String propertyName = Property.getPropertyName(subnode);
!
Root.CollectionType collectType = Root.CollectionType.collectionTypeFromString(name);
Value value = null;
--- 44,69 ----
Node discriminatorNode = atts.getNamedItem("discriminator-value");
discriminatorValue = (discriminatorNode==null) ? className : discriminatorNode.getNodeValue();
!
}
!
public String getDiscriminatorValue() {
return discriminatorValue;
}
!
protected void addSubclass(Subclass subclass) {
subclasses.add(subclass);
}
!
protected void propertiesFromXML(Node node, Root root) throws MappingException {
!
NodeList list = node.getChildNodes();
String path = StringHelper.unqualify(className);
Table table = getTable();
for ( int i=0; i<list.getLength(); i++ ) {
!
Node subnode = list.item(i);
String name = subnode.getNodeName();
String propertyName = Property.getPropertyName(subnode);
!
Root.CollectionType collectType = Root.CollectionType.collectionTypeFromString(name);
Value value = null;
***************
*** 92,96 ****
root.addPersistentClass(subclass);
}
! if ( value!=null) {
value.setTypeByReflection(persistentClass, propertyName);
value.createForeignKeys(root, table);
--- 92,96 ----
root.addPersistentClass(subclass);
}
! if ( value!=null) {
value.setTypeByReflection(persistentClass, propertyName);
value.createForeignKeys(root, table);
***************
*** 99,107 ****
}
}
!
public boolean hasSubclasses() {
return subclasses.size() > 0;
}
!
public int getSubclassSpan() {
int n = subclasses.size();
--- 99,107 ----
}
}
!
public boolean hasSubclasses() {
return subclasses.size() > 0;
}
!
public int getSubclassSpan() {
int n = subclasses.size();
***************
*** 143,151 ****
return table;
}
!
public Class getPersistentClass() {
return persistentClass;
}
!
public String getName() {
return persistentClass.getName();
--- 143,151 ----
return table;
}
!
public Class getPersistentClass() {
return persistentClass;
}
!
public String getName() {
return persistentClass.getName();
***************
*** 167,171 ****
public abstract Iterator getPropertyClosureIterator();
public abstract Iterator getTableClosureIterator();
!
protected void addSubclassProperty(Property p) {
subclassProperties.add(p);
--- 167,171 ----
public abstract Iterator getPropertyClosureIterator();
public abstract Iterator getTableClosureIterator();
!
protected void addSubclassProperty(Property p) {
subclassProperties.add(p);
***************
*** 190,191 ****
--- 190,194 ----
public abstract Value getKey();
}
+
+
+
Index: PrimaryKey.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/PrimaryKey.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PrimaryKey.java 1 Jan 2003 13:56:20 -0000 1.1.1.1
--- PrimaryKey.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 7,11 ****
public class PrimaryKey extends Constraint {
!
public String sqlConstraintString(Dialect d) {
StringBuffer buf = new StringBuffer(" primary key (");
--- 7,11 ----
public class PrimaryKey extends Constraint {
!
public String sqlConstraintString(Dialect d) {
StringBuffer buf = new StringBuffer(" primary key (");
***************
*** 19,24 ****
public String sqlConstraintString(Dialect d, String constraintName) {
! StringBuffer buf = new StringBuffer(
! d.getAddPrimaryKeyConstraintString(constraintName)
).append('(');
Iterator iter = getColumnIterator();
--- 19,24 ----
public String sqlConstraintString(Dialect d, String constraintName) {
! StringBuffer buf = new StringBuffer(
! d.getAddPrimaryKeyConstraintString(constraintName)
).append('(');
Iterator iter = getColumnIterator();
***************
*** 30,32 ****
--- 30,35 ----
}
}
+
+
+
Index: PrimitiveArray.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/PrimitiveArray.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PrimitiveArray.java 1 Jan 2003 13:56:20 -0000 1.1.1.1
--- PrimitiveArray.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 17,18 ****
--- 17,21 ----
}
+
+
+
Index: Property.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Property.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Property.java 1 Jan 2003 13:56:20 -0000 1.1.1.1
--- Property.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 13,17 ****
private final Value value;
private String cascade;
!
public String toString() {
return "Property: " + name;
--- 13,17 ----
private final Value value;
private String cascade;
!
public String toString() {
return "Property: " + name;
***************
*** 36,45 ****
public Property(Node node, Value value, Root root) throws MappingException {
name = getPropertyName(node);
! this.value=value;
Type type = value.getType();
if (type==null) throw new MappingException( "Could not determine a property type for: " + name );
Node cascadeNode = node.getAttributes().getNamedItem("cascade");
cascade = (cascadeNode==null) ? root.getDefaultCascade() : cascadeNode.getNodeValue();
! }
public Value getValue() {
--- 36,45 ----
public Property(Node node, Value value, Root root) throws MappingException {
name = getPropertyName(node);
! this.value=value;
Type type = value.getType();
if (type==null) throw new MappingException( "Could not determine a property type for: " + name );
Node cascadeNode = node.getAttributes().getNamedItem("cascade");
cascade = (cascadeNode==null) ? root.getDefaultCascade() : cascadeNode.getNodeValue();
! }
public Value getValue() {
***************
*** 52,57 ****
if (propertyName==null) propertyName = atts.getNamedItem("role");
return (propertyName==null) ? null : propertyName.getNodeValue();
! }
!
public Cascades.CascadeStyle cascade() throws MappingException {
if ( value.getType().isComponentType() ) {
--- 52,57 ----
if (propertyName==null) propertyName = atts.getNamedItem("role");
return (propertyName==null) ? null : propertyName.getNodeValue();
! }
!
public Cascades.CascadeStyle cascade() throws MappingException {
if ( value.getType().isComponentType() ) {
***************
*** 81,86 ****
}
}
- }
--- 81,89 ----
}
}
+
+
+ }
+
Index: RelationalModel.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/RelationalModel.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** RelationalModel.java 1 Jan 2003 13:56:20 -0000 1.1.1.1
--- RelationalModel.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 11,12 ****
--- 11,15 ----
}
+
+
+
Index: Root.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Root.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Root.java 2 Jan 2003 11:01:49 -0000 1.2
--- Root.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 53,85 ****
return xmlTag;
}
! private static final CollectionType MAP = new CollectionType("map") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Map(node, prefix, owner, root);
! }
};
! private static final CollectionType SET = new CollectionType("set") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Set(node, prefix, owner, root);
}
};
! private static final CollectionType LIST = new CollectionType("list") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new List(node, prefix, owner, root);
! }
};
! private static final CollectionType BAG = new CollectionType("bag") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Bag(node, prefix, owner, root);
! }
};
! private static final CollectionType ARRAY = new CollectionType("array") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Array(node, prefix, owner, root);
! }
};
! private static final CollectionType PRIMITIVE_ARRAY = new CollectionType("primitive-array") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new PrimitiveArray(node, prefix, owner, root);
! }
};
private static final HashMap INSTANCES = new HashMap();
--- 53,85 ----
return xmlTag;
}
! private static final CollectionType MAP = new CollectionType("map") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Map(node, prefix, owner, root);
! }
};
! private static final CollectionType SET = new CollectionType("set") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Set(node, prefix, owner, root);
}
};
! private static final CollectionType LIST = new CollectionType("list") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new List(node, prefix, owner, root);
! }
};
! private static final CollectionType BAG = new CollectionType("bag") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Bag(node, prefix, owner, root);
! }
};
! private static final CollectionType ARRAY = new CollectionType("array") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new Array(node, prefix, owner, root);
! }
};
! private static final CollectionType PRIMITIVE_ARRAY = new CollectionType("primitive-array") {
! public Collection create(Node node, String prefix, PersistentClass owner, Root root) throws MappingException {
! return new PrimitiveArray(node, prefix, owner, root);
! }
};
private static final HashMap INSTANCES = new HashMap();
***************
*** 98,102 ****
public Root(
! Document doc,
java.util.Map classes,
java.util.Map collections,
--- 98,102 ----
public Root(
! Document doc,
java.util.Map classes,
java.util.Map collections,
***************
*** 111,117 ****
this.tables = tables;
this.generators = generators;
!
// Create maps for all the collections and classes
!
Node hmNode = doc.getElementsByTagName("hibernate-mapping").item(0);
Node schemaNode = hmNode.getAttributes().getNamedItem("schema");
--- 111,117 ----
this.tables = tables;
this.generators = generators;
!
// Create maps for all the collections and classes
!
Node hmNode = doc.getElementsByTagName("hibernate-mapping").item(0);
Node schemaNode = hmNode.getAttributes().getNamedItem("schema");
***************
*** 137,141 ****
if (old!=null) throw new MappingException("duplicate query name: " + qname);
}
!
}
}
--- 137,141 ----
if (old!=null) throw new MappingException("duplicate query name: " + qname);
}
!
}
}
***************
*** 156,175 ****
}
! public Table addTable(String schema, String name)
! {
! String key = schema != null ? schema + "." + name : name;
!
! Table table = (Table)tables.get(key);
!
! if (table == null) {
! table = new Table();
! table.setName(name);
! table.setSchema(schema);
! tables.put(key, table);
! }
!
! return table;
}
!
public String getSchemaName() {
return schemaName;
--- 156,175 ----
}
! public Table addTable(String schema, String name)
! {
! String key = schema != null ? schema + "." + name : name;
!
! Table table = (Table)tables.get(key);
!
! if (table == null) {
! table = new Table();
! table.setName(name);
! table.setSchema(schema);
! tables.put(key, table);
! }
!
! return table;
}
!
public String getSchemaName() {
return schemaName;
***************
*** 182,186 ****
public IdentifierGenerator createIDGenerator(Node node) throws Exception {
!
String className = node.getAttributes().getNamedItem("class").getNodeValue();
Class idgenClass = (Class) idgenerators.get(className);
--- 182,186 ----
public IdentifierGenerator createIDGenerator(Node node) throws Exception {
!
String className = node.getAttributes().getNamedItem("class").getNodeValue();
Class idgenClass = (Class) idgenerators.get(className);
***************
*** 207,211 ****
list.toArray(args);
IdentifierGenerator idgen;
! Object gen = null;
try {
gen = idgenClass.getConstructor(argTypes).newInstance(args);
--- 207,211 ----
list.toArray(args);
IdentifierGenerator idgen;
! Object gen = null;
try {
gen = idgenClass.getConstructor(argTypes).newInstance(args);
***************
*** 216,220 ****
idgen = (IdentifierGenerator) gen;
!
if ( PersistentIdentifierGenerator.class.isAssignableFrom(idgenClass) ) {
generators.put( ( (PersistentIdentifierGenerator) idgen ).generatorKey(), idgen );
--- 216,220 ----
idgen = (IdentifierGenerator) gen;
!
if ( PersistentIdentifierGenerator.class.isAssignableFrom(idgenClass) ) {
generators.put( ( (PersistentIdentifierGenerator) idgen ).generatorKey(), idgen );
***************
*** 232,269 ****
idgenerators.put("vm.hex", HexGenerator.class);
idgenerators.put("assigned", Assigned.class);
! idgenerators.put("native", NativeGenerator.class);
! idgenerators.put("sequence", SequenceGenerator.class);
! idgenerators.put("seqhilo.long", SequenceHiLoGenerator.class);
}
public CacheConcurrencyStrategy createJCSCache(Node node, String name, PersistentClass owner) throws MappingException {
! String usage = node.getAttributes().getNamedItem("usage").getNodeValue();
! final Cache jcs;
! try {
! jcs = new JCSCache();
! }
! catch (NoClassDefFoundError ncf) {
! log.warn( "Could not instantiate cache - probably the JCS jar is missing", ncf );
! // continue with no cache
! return null;
! }
! try {
! jcs.setClass(name);
! }
! catch (CacheException ce) {
! throw new MappingException("Could not instantiate JCS",ce);
! }
! if ( usage.equals("read-only") ) {
! if ( owner.isMutable() ) log.warn( "read-only cache configured for mutable: " + name );
! return new ReadOnlyCache(jcs);
! }
! else if ( usage.equals("read-write") ) {
! return new ReadWriteCache(jcs);
! }
! else {
! throw new MappingException("jcs-cache usage attribute should be read-write or read-only");
! }
}
!
}
--- 232,272 ----
idgenerators.put("vm.hex", HexGenerator.class);
idgenerators.put("assigned", Assigned.class);
! idgenerators.put("native", NativeGenerator.class);
! idgenerators.put("sequence", SequenceGenerator.class);
! idgenerators.put("seqhilo.long", SequenceHiLoGenerator.class);
}
public CacheConcurrencyStrategy createJCSCache(Node node, String name, PersistentClass owner) throws MappingException {
! String usage = node.getAttributes().getNamedItem("usage").getNodeValue();
! final Cache jcs;
! try {
! jcs = new JCSCache();
! }
! catch (NoClassDefFoundError ncf) {
! log.warn( "Could not instantiate cache - probably the JCS jar is missing", ncf );
! // continue with no cache
! return null;
! }
! try {
! jcs.setClass(name);
! }
! catch (CacheException ce) {
! throw new MappingException("Could not instantiate JCS",ce);
! }
! if ( usage.equals("read-only") ) {
! if ( owner.isMutable() ) log.warn( "read-only cache configured for mutable: " + name );
! return new ReadOnlyCache(jcs);
! }
! else if ( usage.equals("read-write") ) {
! return new ReadWriteCache(jcs);
! }
! else {
! throw new MappingException("jcs-cache usage attribute should be read-write or read-only");
! }
}
!
}
+
+
+
Index: RootClass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/RootClass.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RootClass.java 2 Jan 2003 11:01:49 -0000 1.2
--- RootClass.java 4 Jan 2003 11:15:29 -0000 1.3
***************
*** 34,42 ****
private final boolean explicitPolymorphism;
private Class persister;
!
public String toString() {
return "RootClass: " + getPersistentClass().getName();
}
!
public Property getIdentifierProperty() {
return identifierProperty;
--- 34,42 ----
private final boolean explicitPolymorphism;
private Class persister;
!
public String toString() {
return "RootClass: " + getPersistentClass().getName();
}
!
public Property getIdentifierProperty() {
return identifierProperty;
***************
*** 48,56 ****
return identifierProperty!=null;
}
!
public Value getDiscriminator() {
return discriminator;
}
!
public boolean isInherited() {
return false;
--- 48,56 ----
return identifierProperty!=null;
}
!
public Value getDiscriminator() {
return discriminator;
}
!
public boolean isInherited() {
return false;
***************
*** 59,67 ****
return polymorphic;
}
!
public void setPolymorphic(boolean polymorphic) {
this.polymorphic = polymorphic;
}
!
public RootClass getRootClass() {
return this;
--- 59,67 ----
return polymorphic;
}
!
public void setPolymorphic(boolean polymorphic) {
this.polymorphic = polymorphic;
}
!
public RootClass getRootClass() {
return this;
***************
*** 73,77 ****
return Collections.singleton( getTable() ).iterator();
}
!
protected void addSubclass(Subclass subclass) {
super.addSubclass(subclass);
--- 73,77 ----
return Collections.singleton( getTable() ).iterator();
}
!
protected void addSubclass(Subclass subclass) {
super.addSubclass(subclass);
***************
*** 82,86 ****
return explicitPolymorphism;
}
!
public RootClass(Node node, Root root) throws MappingException {
super(node);
--- 82,86 ----
return explicitPolymorphism;
}
!
public RootClass(Node node, Root root) throws MappingException {
super(node);
***************
*** 89,99 ****
//TABLENAME
Node tableNameNode = atts.getNamedItem("table");
! String tableName = (tableNameNode==null) ?
! StringHelper.unqualify( getPersistentClass().getName() ) :
! tableNameNode.getNodeValue();
!
Node schemaNode = atts.getNamedItem("schema");
String schema = schemaNode==null ? root.getSchemaName() : schemaNode.getNodeValue();
! Table table = root.addTable(schema, tableName);
setTable(table);
--- 89,99 ----
//TABLENAME
Node tableNameNode = atts.getNamedItem("table");
! String tableName = (tableNameNode==null) ?
! StringHelper.unqualify( getPersistentClass().getName() ) :
! tableNameNode.getNodeValue();
!
Node schemaNode = atts.getNamedItem("schema");
String schema = schemaNode==null ? root.getSchemaName() : schemaNode.getNodeValue();
! Table table = root.addTable(schema, tableName);
setTable(table);
***************
*** 111,115 ****
}
}
!
//DISCRIMINATOR (deprecated; to support old DTD)
Node discriminatorColumnNode = atts.getNamedItem("discriminator");
--- 111,115 ----
}
}
!
//DISCRIMINATOR (deprecated; to support old DTD)
Node discriminatorColumnNode = atts.getNamedItem("discriminator");
***************
*** 132,140 ****
NodeList list = node.getChildNodes();
for ( int i=0; i<list.getLength(); i++ ) {
!
Node subnode = list.item(i);
String name = subnode.getNodeName();
String propertyName = Property.getPropertyName(subnode);
!
if ( "id".equals(name) ) {
if (propertyName==null) {
--- 132,140 ----
NodeList list = node.getChildNodes();
for ( int i=0; i<list.getLength(); i++ ) {
!
Node subnode = list.item(i);
String name = subnode.getNodeName();
String propertyName = Property.getPropertyName(subnode);
!
if ( "id".equals(name) ) {
if (propertyName==null) {
***************
*** 217,221 ****
cache = root.createJCSCache(subnode, getPersistentClass().getName(), this);
}
!
}
//Primary key constraint
--- 217,221 ----
cache = root.createJCSCache(subnode, getPersistentClass().getName(), this);
}
!
}
//Primary key constraint
***************
*** 229,237 ****
//root.addPrimaryKey(pk); //No good for postgres
table.setPrimaryKey(pk);
!
propertiesFromXML(node, root);
!
}
!
public Property getVersion() {
return version;
--- 229,237 ----
//root.addPrimaryKey(pk); //No good for postgres
table.setPrimaryKey(pk);
!
propertiesFromXML(node, root);
!
}
!
public Property getVersion() {
return version;
***************
*** 243,251 ****
return version!=null;
}
!
public CacheConcurrencyStrategy getCache() {
return cache;
}
!
public boolean isMutable() {
return mutable;
--- 243,251 ----
return version!=null;
}
!
public CacheConcurrencyStrategy getCache() {
return cache;
}
!
public boolean isMutable() {
return mutable;
***************
*** 254,270 ****
return embeddedIdentifier;
}
!
public Class getPersister() {
return persister;
}
!
public Table getRootTable() {
return getTable();
}
!
public void setPersister(Class persister) {
this.persister = persister;
}
!
public PersistentClass getSuperclass() {
return null;
--- 254,270 ----
return embeddedIdentifier;
}
!
public Class getPersister() {
return persister;
}
!
public Table getRootTable() {
return getTable();
}
!
public void setPersister(Class persister) {
this.persister = persister;
}
!
public PersistentClass getSuperclass() {
return null;
***************
*** 275,276 ****
--- 275,279 ----
}
}
+
+
+
Index: Set.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Set.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Set.java 1 Jan 2003 13:56:24 -0000 1.1.1.1
--- Set.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 14,18 ****
public class Set extends Collection {
!
private final boolean sorted;
private Comparator comparator;
--- 14,18 ----
public class Set extends Collection {
!
private final boolean sorted;
private Comparator comparator;
***************
*** 75,79 ****
public void secondPassCompile(Map persistentClasses)
! throws MappingException {
super.secondPassCompile(persistentClasses);
--- 75,79 ----
public void secondPassCompile(Map persistentClasses)
! throws MappingException {
super.secondPassCompile(persistentClasses);
***************
*** 84,88 ****
}
}
!
}
--- 84,91 ----
}
}
!
}
+
+
+
Index: Subclass.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Subclass.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Subclass.java 1 Jan 2003 13:56:24 -0000 1.1.1.1
--- Subclass.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 15,23 ****
private final PersistentClass superclass;
private Value key;
!
public CacheConcurrencyStrategy getCache() {
return getSuperclass().getCache();
}
!
public String toString() {
return "Subclass: " + getPersistentClass().getName();
--- 15,23 ----
private final PersistentClass superclass;
private Value key;
!
public CacheConcurrencyStrategy getCache() {
return getSuperclass().getCache();
}
!
public String toString() {
return "Subclass: " + getPersistentClass().getName();
***************
*** 27,35 ****
return getSuperclass().getRootClass();
}
!
public PersistentClass getSuperclass() {
return superclass;
}
!
public Property getIdentifierProperty() {
return getSuperclass().getIdentifierProperty();
--- 27,35 ----
return getSuperclass().getRootClass();
}
!
public PersistentClass getSuperclass() {
return superclass;
}
!
public Property getIdentifierProperty() {
return getSuperclass().getIdentifierProperty();
***************
*** 53,57 ****
return true;
}
!
public void addProperty(Property p) {
super.addProperty(p);
--- 53,57 ----
return true;
}
!
public void addProperty(Property p) {
super.addProperty(p);
***************
*** 63,73 ****
}
public Iterator getPropertyClosureIterator() {
! return new JoinedIterator( new Iterator[] {
! getPropertyIterator(),
! getSuperclass().getPropertyClosureIterator() }
);
}
public Iterator getTableClosureIterator() {
! return new JoinedIterator( new Iterator[] {
getSuperclass().getTableClosureIterator(),
Collections.singleton( getTable() ).iterator()
--- 63,73 ----
}
public Iterator getPropertyClosureIterator() {
! return new JoinedIterator( new Iterator[] {
! getPropertyIterator(),
! getSuperclass().getPropertyClosureIterator() }
);
}
public Iterator getTableClosureIterator() {
! return new JoinedIterator( new Iterator[] {
getSuperclass().getTableClosureIterator(),
Collections.singleton( getTable() ).iterator()
***************
*** 78,87 ****
getSuperclass().addSubclassProperty(p);
}
!
protected void addSubclassTable(Table table) {
super.addSubclassTable(table);
getSuperclass().addSubclassTable(table);
}
!
public Subclass(PersistentClass superclass, Node node, Table table, Root root) throws MappingException {
super(node);
--- 78,87 ----
getSuperclass().addSubclassProperty(p);
}
!
protected void addSubclassTable(Table table) {
super.addSubclassTable(table);
getSuperclass().addSubclassTable(table);
}
!
public Subclass(PersistentClass superclass, Node node, Table table, Root root) throws MappingException {
super(node);
***************
*** 95,99 ****
if (tableNameNode==null) {
//ordinary subclasses
!
if ( getPersister()==null ) {
getRootClass().setPersister(EntityPersister.class);
--- 95,99 ----
if (tableNameNode==null) {
//ordinary subclasses
!
if ( getPersister()==null ) {
getRootClass().setPersister(EntityPersister.class);
***************
*** 112,116 ****
Node schemaNode = atts.getNamedItem("schema");
String schema = schemaNode==null ? root.getSchemaName() : schemaNode.getNodeValue();
! Table mytable = root.addTable(schema, tableName);
setTable(mytable);
--- 112,116 ----
Node schemaNode = atts.getNamedItem("schema");
String schema = schemaNode==null ? root.getSchemaName() : schemaNode.getNodeValue();
! Table mytable = root.addTable(schema, tableName);
setTable(mytable);
***************
*** 120,124 ****
pk.setName( StringHelper.suffix( tableName, "PK" ) );
mytable.setPrimaryKey(pk);
!
NodeList subnodes = node.getChildNodes();
for ( int i=0; i<subnodes.getLength(); i++ ) {
--- 120,124 ----
pk.setName( StringHelper.suffix( tableName, "PK" ) );
mytable.setPrimaryKey(pk);
!
NodeList subnodes = node.getChildNodes();
for ( int i=0; i<subnodes.getLength(); i++ ) {
***************
*** 135,142 ****
pk.addColumn(col);
}
!
ForeignKey fk = mytable.createForeignKey( key.getConstraintColumns() );
fk.setReferencedClass( superclass.getPersistentClass() );
!
}
--- 135,142 ----
pk.addColumn(col);
}
!
ForeignKey fk = mytable.createForeignKey( key.getConstraintColumns() );
fk.setReferencedClass( superclass.getPersistentClass() );
!
}
***************
*** 157,161 ****
return getSuperclass().getPersister();
}
!
public Table getRootTable() {
return getSuperclass().getRootTable();
--- 157,161 ----
return getSuperclass().getPersister();
}
!
public Table getRootTable() {
return getSuperclass().getRootTable();
***************
*** 170,177 ****
}
}
!
public boolean isExplicitPolymorphism() {
return getSuperclass().isExplicitPolymorphism();
}
!
}
--- 170,180 ----
}
}
!
public boolean isExplicitPolymorphism() {
return getSuperclass().isExplicitPolymorphism();
}
!
}
+
+
+
Index: Table.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Table.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Table.java 1 Jan 2003 13:56:25 -0000 1.1.1.1
--- Table.java 4 Jan 2003 11:15:29 -0000 1.2
***************
*** 25,46 ****
private IdentifierGenerator identifierGenerator = Assigned.INSTANCE;
private PrimaryKey primaryKey;
! private Map indexes = new HashMap();
! private Map foreignKeys = new HashMap();
! private Map uniqueKeys = new HashMap();
private final int uniqueInteger;
private static int tableCounter=0;
!
public Table() {
uniqueInteger = tableCounter++;
}
!
public String getQualifiedName() {
return (schema==null) ? name : schema + '.' + name;
}
!
public String getQualifiedName(String defaultQualifier) {
return ( schema==null ) ? ( (defaultQualifier==null) ? name : defaultQualifier + '.' + name ) : getQualifiedName();
}
!
public String getName() {
return name;
--- 25,46 ----
private IdentifierGenerator identifierGenerator = Assigned.INSTANCE;
private PrimaryKey primaryKey;
! private Map indexes = new HashMap();
! private Map foreignKeys = new HashMap();
! private Map uniqueKeys = new HashMap();
private final int uniqueInteger;
private static int tableCounter=0;
!
public Table() {
uniqueInteger = tableCounter++;
}
!
public String getQualifiedName() {
return (schema==null) ? name : schema + '.' + name;
}
!
public String getQualifiedName(String defaultQualifier) {
return ( schema==null ) ? ( (defaultQualifier==null) ? name : defaultQualifier + '.' + name ) : getQualifiedName();
}
!
public String getName() {
return name;
***************
*** 49,53 ****
this.name = name;
}
!
public Column ...
[truncated message content] |