Skip to content

Commit 8f96e52

Browse files
committed
Fix ProxyInstanceImpl#getTableSchemas duplicate schemas
1 parent c80dee1 commit 8f96e52

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

core/src/main/java/me/zort/sqllib/mapping/ProxyInstanceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
6060

6161
@Override
6262
public List<TableSchema> getTableSchemas(NamingStrategy namingStrategy, boolean sqLite) {
63+
List<Class<?>> builtTypes = new ArrayList<>();
6364
List<TableSchema> schemaList = new ArrayList<>();
6465
for (Method method : getTypeClass().getDeclaredMethods()) {
6566
Class<?> resultType = mappingResultAdapter.retrieveResultType(method);
6667

67-
if (!QueryResult.class.isAssignableFrom(resultType) && statementMapping.isMappingMethod(method)) {
68+
if (!QueryResult.class.isAssignableFrom(resultType) && statementMapping.isMappingMethod(method) && !builtTypes.contains(resultType)) {
6869
String table = options.getTable() != null ? options.getTable() : Table.Util.getFromContext(method, null);
6970
schemaList.add(new EntitySchemaBuilder(table, resultType, namingStrategy, sqLite).buildTableSchema());
71+
builtTypes.add(resultType);
7072
}
7173
}
7274
return schemaList;

0 commit comments

Comments
 (0)