Skip to content

Commit 0a684f9

Browse files
Add equals and hashcode overwrite to QueryColumn
1 parent abdab9e commit 0a684f9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/org/javawebstack/orm/query/QueryColumn.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.javawebstack.orm.exception.ORMQueryException;
55

66
import java.util.Arrays;
7+
import java.util.Objects;
78
import java.util.regex.Pattern;
89
import java.util.stream.Collectors;
910

@@ -48,4 +49,16 @@ private static void validateName(String name) {
4849
throw new ORMQueryException("Invalid column name '" + name + "' (Use raw in case you know what you're doing)");
4950
}
5051

52+
@Override
53+
public boolean equals(Object o) {
54+
if (this == o) return true;
55+
if (o == null || getClass() != o.getClass()) return false;
56+
QueryColumn that = (QueryColumn) o;
57+
return toString().equals(that.toString());
58+
}
59+
60+
@Override
61+
public int hashCode() {
62+
return Objects.hash(toString());
63+
}
5164
}

0 commit comments

Comments
 (0)