[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2189) Left Outer Join Conditions

yann degat (JIRA) noreply at atlassian.com
Fri Oct 27 09:00:04 EDT 2006


Left Outer Join Conditions
--------------------------

         Key: HHH-2189
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2189
     Project: Hibernate3
        Type: Bug

  Components: query-sql  
    Versions: 3.1.3    
    Reporter: yann degat
    Priority: Blocker
 Attachments: OracleJoinFragment.java, OracleJoinFragment.java

the "org.hibernate.sql.OracleJoinFragment.addLeftOuterJoinCondition"
does not take the "!=" operator into account.

it places the "(+)" like this "!(+)=" instead of " (+) !="
(  != is a valid operator for Oracle )
and it returns  (+)<(+)> for the '<>' operator

here's a patch. (maybe not the best one )
	/**
	 * This method is a bit of a hack, and assumes
	 * that the column on the "right" side of the
	 * join appears on the "left" side of the
	 * operator, which is extremely wierd if this
	 * was a normal join condition, but is natural
	 * for a filter.
	 */
	private void addLeftOuterJoinCondition(String on) {
		StringBuffer buf = new StringBuffer( on );
		for ( int i = 0; i < buf.length(); i++ ) {
            char character = buf.charAt( i );
            boolean isInsertPoint = OPERATORS.contains( new Character( character ) ) ||
           ( character == ' ' && buf.length() > i + 3 && "is ".equals( buf.substring( i + 1, i + 4 ) ) ) ;

            if( character == '<' && buf.length() > i + 1 && ">".equals( buf.substring( i + 1, i + 2 ) ) ){
                isInsertPoint = false;
                buf.insert( i, "(+)" );
                i += 3 + 2;
            }
            
            if ( isInsertPoint ) {
                buf.insert( i, "(+)" );
                i += 3;
            }
           if( character == '!' && buf.length() > i + 1 && "=".equals( buf.substring( i + 1, i + 2 ) ) ){
               buf.insert( i, "(+)" );
               i += 3 + 2;
           }
		}
		addCondition( buf.toString() );
	}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list