Changeset 1887
- Timestamp:
- 05/15/09 14:42:55 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
jmatter-complet/trunk/jmatter/src/com/u2d/persist/HBMMaker.java
r1867 r1887 41 41 private Document _doc; 42 42 private boolean _joinedSubclass = false; 43 43 44 44 public HBMMaker(Class clazz) 45 45 { … … 582 582 else 583 583 { 584 propElem.addAttribute("column", prefix + "_" + field.name());584 addColumnAttribute(propElem, prefix, field); 585 585 } 586 586 } … … 605 605 addAccessAttribute(propElem); 606 606 return propElem; 607 } 608 609 private Set<String> colNames = new HashSet<String>(); 610 /* ensure unique column names */ 611 private void addColumnAttribute(Element propElem, String prefix, Field field) 612 { 613 String colName = String.format("%s_%s", prefix, field.name()); 614 int i=2; 615 while (colNames.contains(colName)) 616 { 617 colName = String.format("%s%d_%s", prefix, i++, field.name()); 618 } 619 propElem.addAttribute("column", colName); 620 colNames.add(colName); 607 621 } 608 622
