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

Version 1.1.3 InExpression can not handle values not null but without any elements #104

Open
GoogleCodeExporter opened this issue Dec 18, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

NOTE: If you have a question rather than a bug report or feature request,
please post at http://groups.google.com/group/java-generic-dao .

What steps will reproduce the problem?
1. In the case I want do an in query
2. I find a list of elements in some time this list may not contains any element
3. I use the Restrictions.in(property, list)

What is the expected output? What do you see instead?
the expected result may something like this Entity.property in ()
but the result is Entity.property in )

What version of the product are you using? On what operating system?
Version 1.1.3

Please provide any additional information below.
    public String toSqlString(Criteria criteria, Criteria.CriteriaQuery criteriaQuery) {
        String sql = criteriaQuery.getPropertyName(property, criteria) + " in ( ";

        for (Object v : values) {
            criteriaQuery.setParam(v);
            sql += "?,";
        }

        return sql.substring(0, sql.length() - 1) + ")";
    }

the return statement not consider the case values.length < 1
the easyest way to solve this problem is add a space after the "in ( "




Original issue reported on code.google.com by jackydu1...@gmail.com on 19 Jun 2013 at 6:29

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