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

Exception Thrown with Camel Cased Embedded Attributes #6

Closed
cciemier opened this issue Mar 30, 2016 · 2 comments
Closed

Exception Thrown with Camel Cased Embedded Attributes #6

cciemier opened this issue Mar 30, 2016 · 2 comments

Comments

@cciemier
Copy link

Thank you for all of your hard work on this project -- it has proven extremely useful!

I have identified an issue where a hibernate QueryException is being thrown. I have a class with an @Embedded attribute that is camel-cased. The result is a "could not resolve property of..." error.

The reason for this error is because the field in the column data is being set to lower case. Therefore, instead of:

locomotive.locomotiveId.mark

I get:

locomotive.locomotiveid.mark

I downloaded your software, and removed "toLowerCase" in line 152 of DataTablesUtils.java:

.or(Expressions.stringOperation(Ops.STRING_CAST, entity.get(column.getData()))

The search capability started to work.

There appear to be other areas in this file where values are transformed into lower case. I have not looked closely enough to understand the implications removing these as well.

I am using QueryDSL.

Thank you for any insight, advice.

Best regards,

--Chris

@darrachequesne
Copy link
Owner

Hi, thanks for your feedback!

You're absolutly right, applying toLowerCase to column.getData() does not make much sense, it's the column itself which should be cast to String and then applied lower().

ed6d755 should fix that, could you confirm please?

@cciemier
Copy link
Author

cciemier commented Apr 4, 2016

Hey Damien,

I have pulled the latest software from the Git repository, and confirm that you have resolved the reported issue. As an FYI, you also fixed another issue regarding case-insensitive searches. Initially, when I attempted to search on a text field, the query generated was case sensitive (since the filter was set to ‘toLowerCase’). The search failed on a Postgres database, because the column was all upper case. I looked at one of your test cases that tested this feature, and notice you are using H2 embedded. I am not sure why the test case was passing, as H2 is case sensitive. However, after this fix, everything seems to be working.

Thank you once again for all of your hard work!

--Chris

From: Damien Arrachequesne [mailto:notifications@github.com]
Sent: Wednesday, March 30, 2016 7:48 PM
To: darrachequesne/spring-data-jpa-datatables spring-data-jpa-datatables@noreply.github.com
Cc: Ciemier, Christopher (CCIEMIER) CCIEMIER@arinc.com
Subject: Re: [darrachequesne/spring-data-jpa-datatables] Exception Thrown with Camel Cased Embedded Attributes (#6)

Hi, thanks for your feedback!

You're absolutly right, applying toLowerCase to column.getData() does not make much sense, it's the column itself which should be cast to String and then applied lower().

ed6d755ed6d755 should fix that, could you confirm please?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-203688261

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

No branches or pull requests

2 participants