Class J


  • public class J
    extends Object
    This class contains helper methods for joins building
    Author:
    Kisel on 26.01.2016.
    • Constructor Summary

      Constructors 
      Constructor Description
      J()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static JoinDescription inner​(com.querydsl.core.types.dsl.CollectionPathBase<?,​?,​?> path)
      Add inner join for given path
      static JoinDescription inner​(com.querydsl.core.types.EntityPath<?> path)
      Add inner join for given path
      static JoinDescription left​(com.querydsl.core.types.dsl.CollectionPathBase<?,​?,​?> path)
      Add left join for given path
      static JoinDescription left​(com.querydsl.core.types.EntityPath<?> path)
      Add left join for given path
      static <P extends com.querydsl.core.types.dsl.SimpleExpression<?>,​T extends com.querydsl.core.types.EntityPath<P>>
      P
      path​(com.querydsl.core.types.dsl.CollectionPathBase<?,​?,​P> path)
      Aliases of nested joins are determined at runtime.
      static <T extends com.querydsl.core.types.EntityPath<?>>
      T
      path​(com.querydsl.core.types.EntityPath<?> grandFather, com.querydsl.core.types.EntityPath<?> father, T path)
      Aliases of nested joins are determined at runtime.
      static <T extends com.querydsl.core.types.EntityPath<?>>
      T
      path​(com.querydsl.core.types.EntityPath<?> parent, T path)
      Aliases of nested joins are determined at runtime.
      static JoinDescription right​(com.querydsl.core.types.EntityPath<?> path)
      Add right join for given path
      static List<JoinDescription> unrollChildrenJoins​(Collection<JoinDescription> joins)
      Collect all joins and its children to single collection
    • Constructor Detail

      • J

        public J()
    • Method Detail

      • path

        public static <P extends com.querydsl.core.types.dsl.SimpleExpression<?>,​T extends com.querydsl.core.types.EntityPath<P>> P path​(com.querydsl.core.types.dsl.CollectionPathBase<?,​?,​P> path)
        Aliases of nested joins are determined at runtime. To refer a nested join, this method should be used to get a correct alias. For example, there is a query

        Q.from(QGroup.group).joins(J.left(QPerson.person).nested(J.left(QContact.contact)))

        To refer a Contact entity in the 'where' clause, one should use J.path(QPerson.person.contacts).number.eq(12345)
        Type Parameters:
        T - any entity path
        Parameters:
        path - path on parent entity
        Returns:
        entity path with correct alias
      • path

        public static <T extends com.querydsl.core.types.EntityPath<?>> T path​(com.querydsl.core.types.EntityPath<?> parent,
                                                                               T path)
        Aliases of nested joins are determined at runtime. To refer a nested join, this method should be used to get a correct alias. For example, there is a query

        Q.from(QGroup.group).joins(J.left(QPerson.person).nested(J.left(QContact.contact)))

        To refer a Contact entity in the 'where' clause, one should use J.path(QPerson.person, QContact.contact).number.eq(12345)
        Type Parameters:
        T - any entity path
        Parameters:
        parent - parent join path
        path - target join path
        Returns:
        entity path with correct alias
      • path

        public static <T extends com.querydsl.core.types.EntityPath<?>> T path​(com.querydsl.core.types.EntityPath<?> grandFather,
                                                                               com.querydsl.core.types.EntityPath<?> father,
                                                                               T path)
        Aliases of nested joins are determined at runtime. To refer a nested join, this method should be used to get a correct alias. For example, there is a query

        Q.from(QGroup.group).joins(J.left(QPerson.person).nested(J.left(QContact.contact).nested(QStatus.status)))

        To refer a Status entity in the 'where' clause, one should use J.path(QPerson.person, QContact.contact. QStatus.status).state.eq("active")
        Type Parameters:
        T - any entity path
        Parameters:
        grandFather - parent of parent join path
        father - parent join path
        path - target join path
        Returns:
        entity path with correct alias
      • left

        public static JoinDescription left​(com.querydsl.core.types.EntityPath<?> path)
        Add left join for given path
        Parameters:
        path - alias of object to be joined
        Returns:
        join description
      • right

        public static JoinDescription right​(com.querydsl.core.types.EntityPath<?> path)
        Add right join for given path
        Parameters:
        path - alias of object to be joined
        Returns:
        join description
      • left

        public static JoinDescription left​(com.querydsl.core.types.dsl.CollectionPathBase<?,​?,​?> path)
        Add left join for given path
        Parameters:
        path - path to an object to be joined
        Returns:
        join description
      • inner

        public static JoinDescription inner​(com.querydsl.core.types.EntityPath<?> path)
        Add inner join for given path
        Parameters:
        path - alias of object to be joined
        Returns:
        join description
      • inner

        public static JoinDescription inner​(com.querydsl.core.types.dsl.CollectionPathBase<?,​?,​?> path)
        Add inner join for given path
        Parameters:
        path - path to an object to be joined
        Returns:
        join description
      • unrollChildrenJoins

        public static List<JoinDescription> unrollChildrenJoins​(Collection<JoinDescription> joins)
        Collect all joins and its children to single collection
        Parameters:
        joins - root joins
        Returns:
        all joins, including children