ncthuc / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

Add fetch mode FETCH_SINGLE #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Add a new fetch mode, perhaps called "FETCH_SINGLE", that returns just one
fetch property and does not wrap it in an array, list or map.

For example,
{{{
Search s = new Search(Person.class);
s.setFetchMode(Search.FETCH_SINGLE);
s.addFetch("name"); //exactly one fetch should be added

List<String> results = generalDAO.search(s);
assertEquals("Mike Wilson", results.get(0));
}}}

Other fetch modes all would return each result as a collection of some
sort. For example:
{{{
s.setFetchMode(Search.FETCH_ARRAY);
List<Object[]> results = generalDAO.search(s);
assertEquals("Mike Wilson", results.get(0)[0]); //note the [0] at the end
of the line.
}}}

Original issue reported on code.google.com by dwolvert on 6 Aug 2008 at 2:23

GoogleCodeExporter commented 8 years ago
The fetch mode FETCH_SINGLE was added as specified.

Original comment by dwolvert on 6 Aug 2008 at 6:04