From: <one...@us...> - 2002-11-16 13:18:41
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/codegen In directory usw-pr-cvs1:/tmp/cvs-serv32462/cirrus/hibernate/tools/codegen Modified Files: ClassMapping.java Log Message: woops ... previous changes got lost Index: ClassMapping.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/codegen/ClassMapping.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ClassMapping.java 16 Nov 2002 13:12:22 -0000 1.14 --- ClassMapping.java 16 Nov 2002 13:18:38 -0000 1.15 *************** *** 13,16 **** --- 13,17 ---- import cirrus.hibernate.type.Type; + import org.apache.commons.lang.StringUtils; import org.jdom.Attribute; import org.jdom.Element; *************** *** 121,124 **** --- 122,143 ---- } + // one to ones + List onetooneList = classElement.getChildren("one-to-one"); + for (Iterator onetoones = onetooneList.iterator(); onetoones.hasNext();) { + Element onetoone = (Element) onetoones.next(); + + String name = onetoone.getAttributeValue("name"); + + // ensure that the class is specified + String clazz = onetoone.getAttributeValue("class"); + if(StringUtils.isEmpty(clazz)) { + System.out.println("one-to-one \"" + name + "\" in class " + getName() + " is missing a class attribute"); + continue; + } + + fields.add(new Field(name, getFieldType(clazz), true)); + + } + // many to ones - TODO: consolidate with code above for (Iterator manytoOnes = classElement.getChildren("many-to-one").iterator(); manytoOnes.hasNext();) { *************** *** 129,133 **** // ensure that the type is specified String type = manyToOne.getAttributeValue("class"); ! if ( type == null || type.trim().equals("") ) { System.out.println("many-to-one \"" + name + "\" in class " + getName() + " is missing a class attribute"); continue; --- 148,152 ---- // ensure that the type is specified String type = manyToOne.getAttributeValue("class"); ! if ( StringUtils.isEmpty(type) ) { System.out.println("many-to-one \"" + name + "\" in class " + getName() + " is missing a class attribute"); continue; |