ebean-orm / ebean

Ebean ORM
https://ebean.io
Apache License 2.0
1.46k stars 260 forks source link

Ebean-Data (auto generated repositories)? #3400

Closed magicprinc closed 2 weeks ago

magicprinc commented 4 months ago

Ebean is a great project and has almost everything one needs or wants. The only advantage of Spring Data JPA left is its auto-generated repositories (The programmer declares an interface, and Spring Data generates the implementation according to the meaning hidden in the method name. IDEA helps to write such names). What do you think about this Spring Data feature? Do you have any plans to support this?

PS: Quarkus has implemented part of it, to help migrate from Spring (google: Quarkus spring data JPA). BTW, It is a good idea to test (to fix, create extension) and advertise Ebean's compatibility with Quarkus. Many people are tired of Spring and are trying to escape. As start: https://github.com/smallrye/jandex And another idea: Quarkus Panache could have some ideas worth to borrow (just impromptu, no practical experience with Panache)

PPS: I mean: query creation from method names.

public interface UserRepository extends Repository<User, Long> {
  List<User> findByEmailAddressAndLastname(String emailAddress, String lastName);
  List<Employees> findFirst5ByFirstNameStartsWithOrderByFirstName(String firstNameStartsWith);
}

PPPS: I am not sure, if it is actually a good thing: Too much magic and syntactic sugar are bad for the health :-)

rbygrave commented 4 months ago

What do you think about this Spring Data feature?

I personally have never liked this feature. The 2 main reasons being that:

Do you have any plans to support this?

No I don't. I do know that a lot of people really like it but those people also don't know about query beans.

Quarkus Panache could have some ideas worth to borrow

Yes, although I think we've already done that (or they've copied a feature we already had). One thing we don't talk about is that ebean has the mode where we can just use public fields on entity beans (omit getters and setters) and ebean enhancement will automatically modify that field access to method access and get full normal functionality in terms of lazy loading and dirty checking etc.

I don't think there is anything outstanding I saw in Panache that we desire but I'll have another look some day in case they have added something.

rbygrave commented 2 weeks ago

Ok, I think we can close this for now. More comments are welcome etc if anyone has anything else to add.