List of usage examples for org.hibernate.sql JoinType FULL_JOIN
JoinType FULL_JOIN
To view the source code for org.hibernate.sql JoinType FULL_JOIN.
Click Source Link
From source file:com.amalto.core.storage.hibernate.StandardQueryHandler.java
License:Open Source License
@Override public StorageResults visit(Join join) { FieldMetadata rightField = join.getRightField().getFieldMetadata(); FieldMetadata leftField = join.getLeftField().getFieldMetadata(); // Choose the right join alias String rightAlias = rightField.getContainingType().getName(); if (rightField.getEntityTypeName().equals(leftField.getEntityTypeName())) { // TMDM-7170: use a new alias for recursive relations rightAlias = createNewAlias();/*from ww w . j a v a 2 s .c o m*/ } // Choose the right join type JoinType joinType; switch (join.getJoinType()) { case INNER: joinType = JoinType.INNER_JOIN; break; case LEFT_OUTER: joinType = JoinType.LEFT_OUTER_JOIN; break; case FULL: joinType = JoinType.FULL_JOIN; break; default: throw new NotImplementedException("No support for join type " + join.getJoinType()); //$NON-NLS-1$ } // Select a path from mainType to the selected field (properties are '.' separated). List<FieldMetadata> path = StorageMetadataUtils.path(mainType, leftField); // Empty path means no path then this is an error (all joined entities should be reachable from main type). if (path.isEmpty()) { String destinationFieldName; try { destinationFieldName = rightField.getName(); } catch (Exception e) { // Ignored if (LOGGER.isDebugEnabled()) { LOGGER.debug("Exception occurred during exception creation", e); //$NON-NLS-1$ } destinationFieldName = String.valueOf(rightField); } throw new IllegalArgumentException("Join to '" + destinationFieldName + "' (in type '" //$NON-NLS-1$ //$NON-NLS-2$ + rightField.getContainingType().getName() + "') is invalid since there is no path from '" //$NON-NLS-1$ + mainType.getName() + "' to this field."); //$NON-NLS-1$ } // Generate all necessary joins to go from main type to join right table. generateJoinPath(Collections.singleton(rightAlias), joinType, path); return null; }