Announcement Announcement Module
Collapse
No announcement yet.
Questions using LIKE & ESCAPE Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Questions using LIKE & ESCAPE

    Prior to using SD JPA, we had a unit test that tests Hibernate/HQL LIKE expressions that include HQL wildcard characters. Now, we're moving to JPA & SD JPA, and that unit test is broken.

    Consider the following dynamic finder method:
    Code:
    List<Foo> findByNameLike(String s);
    What is the default behavior of SD JPA when using LIKE? Does it just prepend & append '%' to the given string, or must the user do that before calling the dynamic like finder method? Does SD JPA check whether the given string contains '_' or '%' and escape them properly? Is it possible to specify the escape character? I can't seem to find any doc on this.

    How does QueryDsl handle this situation? Their StringExpression does contain methods
    Code:
    BooleanExpression like(StringExpression str);
    BooleanExpression like(String str);
    but I don't see how they handle user-specified wildcard escape characters.

    Thanks,
    Matthew
Working...
X