is there any way to get values of certain column combined into single class?

Viewed 86

I'm working with two tables with java Spring MVC project. The result below is SHOP table joined with CUSTOMER table.

| SHOP_NAME | SHOP_NUM  | CUSTOMER_NAME | some other columns aside ... |
| --------- | --------- | ------------- | ---------------------------- |
| 'Mr.Jacks'| 1         | 'Bill'        |                              |
| 'Mr.Jacks'| 1         | 'Ryan'        |                              |
| 'Mr.Jacks'| 1         | 'Kate'        |                              |
| 'Mr.Jacks'| 1         | 'Peter'       |                              |
| 'O`sushi' | 2         | 'Jackson'     |                              |
| 'O`sushi' | 2         | 'Park'        |                              |

And I want to put these into SearchResult VO, which has

private String shopName;
private int shopNo;
private String[] customerNames;

and some other variables.

so with the table above, it's gonna be two SearchResult Objects. one for Mr.Jacks with 4 customer names in it's array and another one for O`sushi with 2 customers.

is there any way to do this with single query in Oracle using mybatis? I've been doing this with 2 database access. one fore selecting shop info and another one for customer column, but I suddenly thought there might be some better way.

0 Answers
Related