diff --git a/querydsl-apt/src/main/java/com/mysema/query/apt/TypeDecl.java b/querydsl-apt/src/main/java/com/mysema/query/apt/TypeDecl.java index d2abf064e..f57bdfa12 100644 --- a/querydsl-apt/src/main/java/com/mysema/query/apt/TypeDecl.java +++ b/querydsl-apt/src/main/java/com/mysema/query/apt/TypeDecl.java @@ -76,19 +76,21 @@ public class TypeDecl implements Comparable{ public int compareTo(TypeDecl o) { return simpleName.compareTo(o.simpleName); } - + public boolean equals(Object o){ + return o instanceof TypeDecl && simpleName.equals(((TypeDecl)o).simpleName); + } public Collection getBooleanFields() { return booleanFields; } - + public Collection getCollectionFields() { return collectionFields; } - + public Collection getConstructors(){ return constructors; } - + public Collection getEntityFields() { return entityFields; } @@ -96,7 +98,7 @@ public class TypeDecl implements Comparable{ public String getName() { return name; } - + public Collection getSimpleFields() { return simpleFields; } @@ -104,15 +106,19 @@ public class TypeDecl implements Comparable{ public String getSimpleName() { return simpleName; } - + public Collection getStringFields() { return stringFields; } - + public String getSupertypeName(){ return superType; } + public int hashCode(){ + return name.hashCode(); + } + public void include(TypeDecl decl) { booleanFields.addAll(decl.booleanFields); collectionFields.addAll(decl.collectionFields); @@ -164,7 +170,9 @@ public class TypeDecl implements Comparable{ public int compareTo(FieldDecl o) { return name.compareTo(o.name); } - + public boolean equals(Object o){ + return o instanceof FieldDecl && name.equals(((FieldDecl)o).name); + } private FieldType forType(String cl){ if (cl.equals(Boolean.class.getName())) return FieldType.BOOLEAN; else if (cl.equals(String.class.getName())) return FieldType.STRING; @@ -183,10 +191,14 @@ public class TypeDecl implements Comparable{ public String getSimpleTypeName(){ return simpleTypeName; } - + public String getTypeName(){ return typeName; } + + public int hashCode(){ + return name.hashCode(); + } } @@ -209,13 +221,20 @@ public class TypeDecl implements Comparable{ public int compareTo(ParameterDecl o) { return name.compareTo(o.name); } + public boolean equals(Object o){ + return o instanceof ParameterDecl && name.equals(((ParameterDecl)o).name); + } public String getName(){ return name; } - + public String getTypeName(){ return typeName; } + + public int hashCode(){ + return name.hashCode(); + } } diff --git a/querydsl-apt/src/main/java/com/mysema/query/apt/hibernate/HibernateProcessor.java b/querydsl-apt/src/main/java/com/mysema/query/apt/hibernate/HibernateProcessor.java index b8ddc3949..5b46abb27 100644 --- a/querydsl-apt/src/main/java/com/mysema/query/apt/hibernate/HibernateProcessor.java +++ b/querydsl-apt/src/main/java/com/mysema/query/apt/hibernate/HibernateProcessor.java @@ -139,7 +139,9 @@ public class HibernateProcessor implements AnnotationProcessor { // serialize it String path = destClass.replace('.', '/') + ".java"; File file = new File(targetFolder, path); - file.getParentFile().mkdirs(); + if (!file.getParentFile().mkdirs()){ + System.err.println("Folder " + file.getParent() + " could not be created"); + } try { Writer out = new OutputStreamWriter(new FileOutputStream(file)); new FreeMarkerSerializer("/querydsl-hibernate.ftl").serialize(