List of usage examples for javax.persistence.criteria JoinType INNER
JoinType INNER
To view the source code for javax.persistence.criteria JoinType INNER.
Click Source Link
From source file:org.batoo.jpa.core.impl.criteria.join.AbstractFrom.java
/** * {@inheritDoc}/*from ww w . j a v a 2 s . c o m*/ * */ @Override public <Y> ListJoinImpl<X, Y> joinList(String attributeName) { return this.joinList(attributeName, JoinType.INNER); }
From source file:org.batoo.jpa.core.impl.criteria.join.AbstractFrom.java
/** * {@inheritDoc}/* w w w. j a v a 2s . c o m*/ * */ @Override public <K, V> MapJoinImpl<X, K, V> joinMap(String attributeName) { return this.joinMap(attributeName, JoinType.INNER); }
From source file:org.batoo.jpa.core.impl.criteria.join.AbstractFrom.java
/** * {@inheritDoc}/*from ww w. java 2s.c om*/ * */ @Override public <Y> SetJoinImpl<X, Y> joinSet(String attributeName) { return this.joinSet(attributeName, JoinType.INNER); }
From source file:org.batoo.jpa.core.impl.criteria.jpql.JpqlQuery.java
/** * Creates the from fragment of the query. * /*from w ww .ja v a 2 s . com*/ * @param cb * the criteria builder * @param q * the query join * @param r * the root * @param joins * the joins metadata * * @since 2.0.0 */ private void constructJoins(CriteriaBuilderImpl cb, AbstractQuery<?> q, RootImpl<Object> r, Tree joins) { for (int i = 0; i < joins.getChildCount(); i++) { final Tree join = joins.getChild(i); JoinType joinType = JoinType.INNER; final int joinSpecification = join.getChild(0).getType(); int offset = 0; if (joinSpecification == JpqlParser.INNER) { offset = 1; joinType = JoinType.INNER; } else if (joinSpecification == JpqlParser.LEFT) { offset = 1; joinType = JoinType.LEFT; } if (join.getChildCount() == (offset + 3)) { FetchParent<?, ?> parent = this.getAliased(q, join.getChild(offset).getText()); final Qualified qualified = new Qualified(join.getChild(offset + 1).getChild(0)); for (final String segment : qualified.getSegments()) { parent = parent.fetch(segment, joinType); } } else { AbstractFrom<?, ?> parent = this.getAliased(q, join.getChild(offset).getText()); final Aliased aliased = new Aliased(join.getChild(offset + 1)); int depth = 0; for (final String segment : aliased.getQualified().getSegments()) { if ((depth > 0) && (parent instanceof PluralJoin)) { throw new PersistenceException( "Cannot qualify, only embeddable joins within the path allowed, " + "line " + join.getLine() + ":" + join.getCharPositionInLine()); } parent = parent.join(segment, joinType); depth++; } parent.alias(aliased.getAlias()); this.putAlias((BaseQuery<?>) q, join.getChild(1), aliased, parent); } } }
From source file:org.easy.criteria.CriteriaComposer.java
/** * Creates a set join with the next entity. Uses JoinType.INNER as default * //from w w w. ja v a2 s .c om * @param <R> * - Class of the next entity * @param attribute * - SetAttribute of this entity that has reference to next * entity * @return Sub criteria for the next joined entity */ public <V> CriteriaComposer<V> join(SetAttribute<? super E, V> attribute) { return join(JoinType.INNER, attribute, null); }
From source file:org.easy.criteria.CriteriaComposer.java
/** * Creates a set join with the next entity. Users JoinType.INNER as default. * //from w w w . ja v a 2s .co m * @param <R> * - Class of the next entity * @param attribute * - SetAttribute of this entity that has reference to next * entity * @return Sub criteria for the next entity */ public <V> CriteriaComposer<V> join(SetAttribute<E, V> attribute, CriteriaComposer<V> subCriteria) { return join(JoinType.INNER, attribute, subCriteria); }
From source file:org.easy.criteria.CriteriaComposer.java
/** * Creates a set join with the next entity. Uses JoinType.INNER as default * /*from www . j av a 2s . c o m*/ * @param <R> * - Class of the next entity * @param attribute * - SingularAttribute of this entity that has reference to next * entity * @return Sub criteria for the next joined entity */ public <V> CriteriaComposer<V> join(SingularAttribute<? super E, V> attribute) { return join(JoinType.INNER, attribute, null); }
From source file:org.easy.criteria.CriteriaComposer.java
/** * Creates a set join with the next entity. Users JoinType.INNER as default. * // w ww. jav a 2 s .c om * @param <R> * - Class of the next entity * @param attribute * - SingularAttribute of this entity that has reference to next * entity * @return Sub criteria for the next joined entity */ public <V> CriteriaComposer<V> join(SingularAttribute<? super E, V> attribute, CriteriaComposer<V> subCriteria) { return join(JoinType.INNER, attribute, subCriteria); }
From source file:org.easy.test.criteria.CriteriaProcessorTest.java
/** * Find all Students//from w ww . j a va 2s. c o m * * select * from person inner join person_type on * person.person_type_id=persontype.id where persontype.name=STUDENT */ @Test public void testFindAllStudent1() { CriteriaComposer<Person> student = CriteriaComposer.from(Person.class); CriteriaComposer<PersonType> personTypeStudent = student.join(JoinType.INNER, Person_.personType); personTypeStudent.where(PersonType_.name, EQUAL, PersonTypeEnum.STUDENT); List<Person> result = criteriaProcessor.findAllEntity(student, true, null); assertNotNull(result); assertTrue(result.size() > 0); assertEquals(9, result.size()); }
From source file:org.easy.test.criteria.CriteriaProcessorTest.java
/** * Find all Students.//w w w .ja v a 2s . co m * Same as 1 but using DOT chaining */ @Test public void testFindAllStudent1b() { // using DOT chaining CriteriaComposer<Person> student = CriteriaComposer.from(Person.class); student.join(JoinType.INNER, Person_.personType).where(PersonType_.name, EQUAL, PersonTypeEnum.STUDENT); List<Person> result = criteriaProcessor.findAllEntity(student, true, null); assertNotNull(result); assertTrue(result.size() > 0); assertEquals(9, result.size()); }