I am not sure what exactly is being generated and how you do that without seeing any code and the exception. However, from the information you have provided you want to create a JavaType with generics. The best way to go about this is to look at the existing sources which generate similar things to what you want to achieve. Here is an example:
This would generate a Set<Order>.
List<JavaType> params = new ArrayList<JavaType>();
JavaType setType = new JavaType("java.util.Set", 0, DataType.TYPE, null, params);
Does this help?