Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0 M2
    • Component/s: Core
    • Labels:
      None

      Description

      The QueryDSL library offers a fluent interface for building type safe (JPA) queries. The API looks a lot smoother than the JPA Criteria API so that an integration would be quite a cool thing. I can imagine collaboration in the following areas:

      Offer Specifications based on QueryDSL

      We could offer an alternative to the standard JPA Criteria API based Specifications as the implementations should become much nicer with Querydsl. So we could have something like this:

      public interface QueryDslSpecificationExecutor<T> {
      
        T findAll(QueryDslSpecification<T>);
      
        // further Specification executing methods like in JpaRepository
      }
      

      We could create a QueryDsl specific subclass of SimpleJpaRepository and use this subclass in case the entity specific repository interface implements this 'mixin' so to speak.

      Provide a simple base class for custom query implementations

      To ease building queries with QueryDsl we could provide a base class that gets an EntityManager injected and allows to create queries via a helper method. This class could be used for custom repository implementations then.

      Links

        Issue Links

          Activity

          Hide
          Timo Westkämper added a comment -

          I looked at the new commits in the Querydsl branch. Here are some comments

          • In the loop where you search for the default path entity path you need to take the first static field with the same type

          e.g.

          public class QUser {
          
            public final QUser friend;
          
            public static final QUser user = new QUser("user"); // this one
          
          }
          
          • The Q class for inner classes is <package>.<prefix><outerclass>_<inner class>

          e.g.

          com.example.Outer.Inner becomes com.example.QOuter_Inner

          Otherwise this looks good.

          Show
          Timo Westkämper added a comment - I looked at the new commits in the Querydsl branch. Here are some comments In the loop where you search for the default path entity path you need to take the first static field with the same type e.g. public class QUser { public final QUser friend; public static final QUser user = new QUser( "user" ); // this one } The Q class for inner classes is <package>.<prefix><outerclass>_<inner class> e.g. com.example.Outer.Inner becomes com.example.QOuter_Inner Otherwise this looks good.
          Hide
          Oliver Gierke added a comment -
          Show
          Oliver Gierke added a comment - Thanks for the hints! Just fixed both issues: https://github.com/SpringSource/spring-data-jpa/commit/960bf09fb0fe1d8b726d967cde8bedebbd24864c
          Hide
          Stevo Slavić added a comment -

          Will this at least preliminary work-in-progress support make it into the spring data jpa v1.0 M2?

          Show
          Stevo Slavić added a comment - Will this at least preliminary work-in-progress support make it into the spring data jpa v1.0 M2?
          Hide
          Oliver Gierke added a comment -

          It's scheduled for M2, so yes .

          Show
          Oliver Gierke added a comment - It's scheduled for M2, so yes .
          Hide
          Stevo Slavić added a comment -

          Asking because there were "rumors" it will be available in M1 already.

          Show
          Stevo Slavić added a comment - Asking because there were "rumors" it will be available in M1 already.

            People

            • Assignee:
              Oliver Gierke
              Reporter:
              Oliver Gierke
            • Votes:
              6 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0.5d
                0.5d
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.5d
                0.5d