import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import com.impossibl.postgres.BasicContext;
import com.impossibl.postgres.system.Version;
import com.impossibl.postgres.system.tables.PgType;


public class Test {
	
	public static class RoleGrant {
		
		enum Role {
			Tester,
			Manager
		}
		
		public UUID account_id;
		public Role role;
		public UUID getAccount_id() {
			return account_id;
		}
		public void setAccount_id(UUID account_id) {
			this.account_id = account_id;
		}
		public Role getRole() {
			return role;
		}
		public void setRole(Role role) {
			this.role = role;
		}
	}
	
	public static class Helper2 {
		public String node;
		public RoleGrant rg;
		public String getNode() {
			return node;
		}
		public void setNode(String node) {
			this.node = node;
		}
		public RoleGrant getRg() {
			return rg;
		}
		public void setRg(RoleGrant rg) {
			this.rg = rg;
		}
	}

	public static void main(String[] args) throws SQLException, IOException {
		
		try (Socket socket = new Socket(InetAddress.getByName("10.0.10.26"), 5432)) {
				
			Map<String, Object> settings = new HashMap<String, Object>();
			settings.put("database", "impossibl");
			settings.put("username", "postgres");
			settings.put("password", "test");
			
			BasicContext context = new BasicContext(socket, settings);
			context.init();
			
			context.query("select array['A Name','cce010e0-8476-11e2-9e96-0800200c9a66','Tester']", HashMap.class);
		}
		
	}
	
}

@@ -134,31 +134,8 @@
 ap;%0A
-import java.util.List;%0A
 impo
@@ -224,108 +224,10 @@
 xt;%0A
-import com.impossibl.postgres.system.Version;%0Aimport com.impossibl.postgres.system.tables.PgType;
 %0A%0A
-%0A
 publ
@@ -286,342 +286,56 @@
 %09%0A%09%09
-enum Role %7B%0A%09%09%09Tester,%0A%09%09%09Manager%0A%09%09%7D%0A%09%09%0A%09%09public UUID account_id;%0A%09%09public Role role;%0A%09%09public UUID getAccount_id() %7B%0A%09%09%09return account_id;%0A%09%09%7D%0A%09%09public void setAccount_id(UUID account_id) %7B%0A%09%09%09this.account_id = account_id;%0A%09%09%7D%0A%09%09public Role getRole() %7B%0A%09%09%09return role;%0A%09%09%7D%0A%09%09public void setRole(Role role) %7B%0A%09%09%09this.role = role;%0A%09%09%7D
+public UUID account_id;%0A%09%09public String role;%0A%09%09
 %0A%09%7D%0A
@@ -367,16 +367,19 @@
 lper2 %7B%0A
+%09%09%0A
 %09%09public
@@ -421,219 +421,8 @@
 ;%0A%09%09
-public String getNode() %7B%0A%09%09%09return node;%0A%09%09%7D%0A%09%09public void setNode(String node) %7B%0A%09%09%09this.node = node;%0A%09%09%7D%0A%09%09public RoleGrant getRg() %7B%0A%09%09%09return rg;%0A%09%09%7D%0A%09%09public void setRg(RoleGrant rg) %7B%0A%09%09%09this.rg = rg;%0A%09%09%7D
 %0A%09%7D%0A
@@ -774,16 +774,197 @@
 %22);%0A%09%09%09%0A
+%09%09%09Map%3CString, Class%3C?%3E%3E targetTypeMap = new HashMap%3CString, Class%3C?%3E%3E();%0A%09%09%09targetTypeMap.put(%22helper2%22, Helper2.class);%0A%09%09%09targetTypeMap.put(%22role_granter%22, RoleGrant.class);%0A%09%09%09%0A
 %09%09%09Basic
@@ -1014,16 +1014,31 @@
 settings
+, targetTypeMap
 );%0A%09%09%09co
@@ -1162,16 +1162,139 @@
 class);%0A
+%09%09%09context.query(%22select ('A Name',('cce010e0-8476-11e2-9e96-0800200c9a66'::uuid,'Tester'))::helper2%22, HashMap.class);%0A%09%09%09%0A
 %09%09%7D%0A%09%09%0A%09

Test with complex POJO mapping