Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/codegen
In directory sc8-pr-cvs1:/tmp/cvs-serv23710
Modified Files:
ClassMapping.java
Log Message:
CodeGenerator now recognizes <key-many-to-one> (patch by Wolfgang Jung)
Index: ClassMapping.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/codegen/ClassMapping.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ClassMapping.java 16 Nov 2002 13:18:38 -0000 1.15
--- ClassMapping.java 28 Nov 2002 09:54:33 -0000 1.16
***************
*** 68,71 ****
--- 68,81 ----
if ( cmpclass==null || cmpclass.equals("") ) {
propertyList.addAll(cmpid.getChildren("key-property"));
+ for (Iterator it = cmpid.getChildren("key-many-to-one").iterator();
+ it.hasNext(); ) {
+ Element manyToOne = (Element) it.next();
+
+ ClassName classType = new ClassName();
+ classType.setFullyQualifiedName(manyToOne.getAttributeValue("class"));
+ // add an import and field for this property
+ addImport(classType);
+ fields.add(new Field(manyToOne.getAttributeValue("name"), classType.getName(), false));
+ }
}
else {
***************
*** 92,95 ****
--- 102,108 ----
// ensure that the type is specified
String type = property.getAttributeValue("type");
+ if (type == null && cmpid != null) { // for composite-keys
+ type = property.getAttributeValue("class");
+ }
if ( type == null || type.trim().equals("") ) {
System.out.println("property \"" + name + "\" in class " + getName() + " is missing a type attribute");
|