Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch mode FETCH_LIST and FETCH_ARRAY return unexpected result when only one fetch specified #1

Closed
GoogleCodeExporter opened this issue Jul 29, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a Search.
2. Add exactly one fetch.
3. Set fetchMode to FETCH_LIST or FETCH_ARRAY.
4. Run the Search in any Generic or General DAO.

EXPECTED RESULT:
List of Lists with one element each or list of Arrays with one element each.

ACTUAL RESULT:
Both fetch modes return just a List of Objects. Each object is what should
be the single element in the List or Array.

This is the default behavior of Hibernate. We need to find a way to
override it. And perhaps we should have a new fetch mode FETCH_SINGLE.

The reason this behavior is undesirable for us is that searches may be
dynamically built by application users in a custom search or something and
we don't want to have to write special code for the exception where they
only select one column to display.


Original issue reported on code.google.com by dwolvert on 6 Aug 2008 at 1:55

@GoogleCodeExporter
Copy link
Author

Turns out the problem was only with fetch mode FETCH_ARRAY. We had been using 
the
default ResultTransformer for this which has the behavior where if there is one 
field
in the result it uses that field by itself but if there are more it puts them 
in an
array.

We implemented our own result transformer to use for FETCH_ARRAY. It always 
returns
an array.

Original comment by dwolvert on 6 Aug 2008 at 2:14

  • Changed state: Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant