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

How to implement JpaRepository LIKE spring? #1

Open
yujinping opened this issue Jun 12, 2019 · 1 comment
Open

How to implement JpaRepository LIKE spring? #1

yujinping opened this issue Jun 12, 2019 · 1 comment
Assignees

Comments

@yujinping
Copy link

Current behavior

When using jodd write the dao layer,some simple sql execute like this:

class TestDao1<Test> {
 public Test findByName(String name){
       String sql="SELECT $C{Test.*} FROM $T{Test} WHERE $.name=:name";
       Map<String,Object> params = new HashMap<>();
      params.put("name",name);
      //... run the sql and get the Test object;
  }
}

Expected behavior

Any idea for code like spring jpaRepository:

public interface TestDao2<Test>{
   @Query("SELECT $C{Test.*} FROM $T{Test} WHERE $.name=:name")
   public Test findByName(@Var("name") String name);
}

Write less: TestDao2 only 2 line vs TestDao1 much more
@igr
Have any idea or interesting to implement it or enhancement with jodd ?

@igr igr self-assigned this Jun 13, 2019
@igr
Copy link
Member

igr commented Jun 13, 2019

Yap, aware of this; have it on my todo.
Agree, will do it! Let me check how much work it requires.

@igr igr transferred this issue from oblac/jodd Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants