From: <one...@us...> - 2003-01-22 13:06:42
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/map In directory sc8-pr-cvs1:/tmp/cvs-serv15990/hibernate/map Modified Files: Component.java RootClass.java Value.java Log Message: fixed a problem with unsaved-value attribute not being recognized for composite-id Index: Component.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/Component.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Component.java 30 Nov 2002 08:19:00 -0000 1.36 --- Component.java 22 Jan 2003 13:06:39 -0000 1.37 *************** *** 53,57 **** public Component(Node node, Class reflectedClass, String path, PersistentClass owner, boolean isNullable, Table table, Root root) throws MappingException { ! super(); setTable(table); Node classNode = node.getAttributes().getNamedItem("class"); --- 53,57 ---- public Component(Node node, Class reflectedClass, String path, PersistentClass owner, boolean isNullable, Table table, Root root) throws MappingException { ! super(node, root); setTable(table); Node classNode = node.getAttributes().getNamedItem("class"); Index: RootClass.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/RootClass.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** RootClass.java 30 Dec 2002 12:48:52 -0000 1.56 --- RootClass.java 22 Jan 2003 13:06:39 -0000 1.57 *************** *** 7,20 **** import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.w3c.dom.*; import cirrus.hibernate.cache.Cache; import cirrus.hibernate.cache.CacheConcurrencyStrategy; import cirrus.hibernate.cache.HashBelt; - import cirrus.hibernate.cache.ReadWriteCache; import cirrus.hibernate.cache.ReadOnlyCache; import cirrus.hibernate.helpers.ReflectHelper; import cirrus.hibernate.helpers.StringHelper; - import cirrus.hibernate.*; - import cirrus.hibernate.Hibernate; public class RootClass extends PersistentClass { --- 7,23 ---- import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.w3c.dom.NamedNodeMap; ! import org.w3c.dom.Node; ! import org.w3c.dom.NodeList; ! ! import cirrus.hibernate.Hibernate; ! import cirrus.hibernate.MappingException; import cirrus.hibernate.cache.Cache; import cirrus.hibernate.cache.CacheConcurrencyStrategy; import cirrus.hibernate.cache.HashBelt; import cirrus.hibernate.cache.ReadOnlyCache; + import cirrus.hibernate.cache.ReadWriteCache; import cirrus.hibernate.helpers.ReflectHelper; import cirrus.hibernate.helpers.StringHelper; public class RootClass extends PersistentClass { Index: Value.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/Value.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** Value.java 26 Dec 2002 03:35:07 -0000 1.45 --- Value.java 22 Jan 2003 13:06:39 -0000 1.46 *************** *** 4,14 **** import java.util.ArrayList; import java.util.Iterator; ! import org.w3c.dom.*; ! import cirrus.hibernate.*; import cirrus.hibernate.helpers.ReflectHelper; import cirrus.hibernate.id.Assigned; import cirrus.hibernate.id.IdentifierGenerator; - import cirrus.hibernate.type.*; import cirrus.hibernate.type.Type; public class Value { --- 4,19 ---- import java.util.ArrayList; import java.util.Iterator; ! ! import org.w3c.dom.NamedNodeMap; ! import org.w3c.dom.Node; ! import org.w3c.dom.NodeList; ! ! import cirrus.hibernate.HibernateException; ! import cirrus.hibernate.MappingException; import cirrus.hibernate.helpers.ReflectHelper; import cirrus.hibernate.id.Assigned; import cirrus.hibernate.id.IdentifierGenerator; import cirrus.hibernate.type.Type; + import cirrus.hibernate.type.TypeFactory; public class Value { *************** *** 52,55 **** --- 57,79 ---- protected Value() {} + + protected Value(Node node, Root root) throws MappingException { + //GENERATOR + NodeList list = node.getChildNodes(); + for ( int i=0; i<list.getLength(); i++ ) { + Node subnode = list.item(i); + if ( "generator".equals( subnode.getNodeName() ) ) { + try { + generator = root.createIDGenerator(subnode); + } catch (Exception e) { + throw new MappingException( "Error creating ID generator",e); + } + if (table!=null) table.setIdentifierGenerator(generator); + } + } + // UNSAVED-VALUE + Node nullValueNode = node.getAttributes().getNamedItem("unsaved-value"); + if (nullValueNode!=null) nullValue = nullValueNode.getNodeValue(); + } public Value(Type type, Table table, String columnName) { *************** *** 63,67 **** //Does _not_ automatically make a column if none is specifed by XML public Value(Node node, String path, boolean isNullable, Table table, Root root) throws MappingException { ! this.table = table; --- 87,91 ---- //Does _not_ automatically make a column if none is specifed by XML public Value(Node node, String path, boolean isNullable, Table table, Root root) throws MappingException { ! this(node, root); this.table = table; *************** *** 123,142 **** addColumn(col); } - //GENERATOR - NodeList list = node.getChildNodes(); - for ( int i=0; i<list.getLength(); i++ ) { - Node subnode = list.item(i); - if ( "generator".equals( subnode.getNodeName() ) ) { - try { - generator = root.createIDGenerator(subnode); - } catch (Exception e) { - throw new MappingException( "Error creating ID generator",e); - } - if (table!=null) table.setIdentifierGenerator(generator); - } - } - // UNSAVED-VALUE - Node nullValueNode = node.getAttributes().getNamedItem("unsaved-value"); - if (nullValueNode!=null) nullValue = nullValueNode.getNodeValue(); } --- 147,150 ---- |