Example usage for javax.persistence.criteria JoinType LEFT

List of usage examples for javax.persistence.criteria JoinType LEFT

Introduction

In this page you can find the example usage for javax.persistence.criteria JoinType LEFT.

Prototype

JoinType LEFT

To view the source code for javax.persistence.criteria JoinType LEFT.

Click Source Link

Document

Left outer join.

Usage

From source file:com.expressui.sample.dao.query.OpportunityQuery.java

@Override
public Path buildOrderBy(Root<Opportunity> opportunity) {
    if (getOrderByPropertyId().equals("account.name")) {
        return opportunity.join("account", JoinType.LEFT).get("name");
    } else {//from  ww  w.  ja  v a2 s . c  om
        return null;
    }
}

From source file:com.expressui.sample.view.opportunity.OpportunityQuery.java

@Override
public Path buildOrderBy(Root<Opportunity> rootEntity) {
    if (getOrderByPropertyId().equals("account.name")) {
        return rootEntity.join("account", JoinType.LEFT).get("name");
    } else {/*  w  w w  . ja v  a 2  s.  co  m*/
        return null;
    }
}

From source file:com.expressui.sample.dao.query.OpportunityQuery.java

@Override
public void addFetchJoins(Root<Opportunity> opportunity) {
    opportunity.fetch("account", JoinType.LEFT);
}

From source file:com.expressui.sample.view.opportunity.OpportunityQuery.java

@Override
public void addFetchJoins(Root<Opportunity> rootEntity) {
    rootEntity.fetch("account", JoinType.LEFT);
}

From source file:net.kaczmarzyk.spring.data.jpa.web.SpecificationArgumentResolverTest.java

@Test
public void resolvesJoinContainer() throws Exception {
    MethodParameter param = MethodParameter.forMethodOrConstructor(testMethod("testMethod_joinContainer"), 0);
    NativeWebRequest req = mock(NativeWebRequest.class);
    when(req.getParameterValues("path1")).thenReturn(new String[] { "value1" });

    Specification<?> resolved = (Specification<?>) resolver.resolveArgument(param, null, req, null);

    assertThat(resolved).isInstanceOf(Conjunction.class);

    Collection<Specification<?>> innerSpecs = ReflectionUtils.get(resolved, "innerSpecs");

    assertThat(innerSpecs).hasSize(2).contains(new Like<Object>("path1", new String[] { "value1" }))
            .contains(new Conjunction<Object>(
                    new net.kaczmarzyk.spring.data.jpa.domain.JoinFetch<Object>(new String[] { "fetch1" },
                            JoinType.LEFT),
                    new net.kaczmarzyk.spring.data.jpa.domain.JoinFetch<Object>(new String[] { "fetch2" },
                            JoinType.INNER)));
}

From source file:com.expressui.sample.dao.query.AccountQuery.java

@Override
public Path buildOrderBy(Root<Account> account) {
    if (getOrderByPropertyId().equals("billingAddress.country")) {
        return account.join("billingAddress", JoinType.LEFT).join("country", JoinType.LEFT);
    } else if (getOrderByPropertyId().equals("billingAddress.state.code")) {
        return account.join("billingAddress", JoinType.LEFT).join("state", JoinType.LEFT).get("code");
    } else {/*from   w ww .jav a  2s  . co m*/
        return null;
    }
}

From source file:com.expressui.sample.view.account.AccountQuery.java

@Override
public Path buildOrderBy(Root<Account> rootEntity) {
    if (getOrderByPropertyId().equals("billingAddress.country")) {
        return rootEntity.join("billingAddress", JoinType.LEFT).join("country", JoinType.LEFT);
    } else if (getOrderByPropertyId().equals("billingAddress.state.code")) {
        return rootEntity.join("billingAddress", JoinType.LEFT).join("state", JoinType.LEFT).get("code");
    } else {//  w  ww.  j  a  v  a  2s.com
        return null;
    }
}

From source file:com.expressui.sample.dao.query.ContactQuery.java

@Override
public void addFetchJoins(Root<Contact> contact) {
    contact.fetch("mailingAddress", JoinType.LEFT);
    contact.fetch("account", JoinType.LEFT);
}

From source file:com.expressui.sample.view.contact.ContactQuery.java

@Override
public Path buildOrderBy(Root<Contact> rootEntity) {
    if (getOrderByPropertyId().equals("mailingAddress.country")) {
        return rootEntity.join("mailingAddress", JoinType.LEFT).join("country", JoinType.LEFT);
    } else if (getOrderByPropertyId().equals("mailingAddress.state.code")) {
        return rootEntity.join("mailingAddress", JoinType.LEFT).join("state", JoinType.LEFT).get("code");
    } else if (getOrderByPropertyId().equals("account.name")) {
        return rootEntity.join("account", JoinType.LEFT).get("name");
    } else {//ww  w  .j av  a 2 s.  c o  m
        return null;
    }
}

From source file:com.expressui.sample.dao.query.AccountQuery.java

@Override
public void addFetchJoins(Root<Account> account) {
    account.fetch("billingAddress", JoinType.LEFT);
}