How can I have a Java method return multiple values?

前端 未结 6 2003
灰色年华
灰色年华 2020-12-21 19:10

I was just wondering whether there\'s a way to make a Java method return multiple values.

I\'m creating an application that uses the jdbc library to work with a data

6条回答
  •  一整个雨季
    2020-12-21 19:35

    Consider using an object/relational mapping library. It will handle the details of packaging the multiple data values you need to return from the JDBC ResultSet into a single Java bean object.

    Which one to pick is another discussion. A lot of smart people use Hibernate. The Java platform includes JPA. Using one off the shelf will save you from inventing your own, which is what devising your own combination of objects and collections would end up being.

提交回复
热议问题