Apache Cayenne > Index > Cayenne Examples > Generics Superclass Template
JDK 1.5 allows for parameterized collection types, called generics. If you are using Cayenne in a 1.5 application, you probably have noticed the frustrating amount of warnings you get when interacting with CayenneDataObjects. This template genericizes the Lists in to-many relationships. When generating classes in the modeler, just select the attached file as your template. If using the ant task, it can be specified as a parameter:
<target name="gen"> <cgen map="datamap.xml" destDir="src_dir" supertemplate="superclass_with_generics.vm" superpkg="com.your.base.cayenne.package" /> </target>
Note that this is for JDK1.5 only. Your code will not compile with JDK1.4 or lower using this template.