This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
When following attribute is defined in element in xsd: <xsd:complexType name="entity"> <xsd:attribute name="class" type="xsd:string" use="required"/> ... and attrProp is set to true in s2b Ant task, following field with appropriate getter.setter is created in generated Entity class: static public final String CLASS2 = "Class2"; There is "Class2" name used, because getClass() is already existing method and getClass2() is generated instead. Problem is in Entity's parent element - EntityMappings, where folowing code is generated: this.createAttribute(EMBEDDABLE, "class", "Class", ...) but it should be: this.createAttribute(EMBEDDABLE, "class", "Class2", ...). "java.lang.IllegalArgumentException: Unknown attribute Class2 for property Entity" is thrown for this call: entityMappings.addEntity(entity);
Created attachment 28887 [details] Thrown exception
Created attachment 28888 [details] Schema with problematic attributes
Created attachment 28889 [details] Very primitive patch for inspiration. It handles this particular problem, but it's not systematic enough.
The determination of whether or not something gets renamed (a number gets appended) is made in BeanBuilder.java. For attributes, it's in addAttrProp around line 481. It has access to the AttrProp and probably should change the name in the AttrProp after determining that the property should get renamed.
Fixed. Checking in BeanBuilder.java; /cvs/schema2beans/dev/src/org/netbeans/modules/schema2beansdev/BeanBuilder.java,v <-- BeanBuilder.java new revision: 1.42.24.1; previous revision: 1.42 done