All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.sql.JoinType Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
Show newest version
package org.hibernate.sql;

import org.hibernate.HibernateException;

/**
 * @author Strong Liu
 */

public enum JoinType {
	NONE( -666 ),
	INNER_JOIN( 0 ),
	LEFT_OUTER_JOIN( 1 ),
	RIGHT_OUTER_JOIN( 2 ),
	FULL_JOIN( 4 );
	private int joinTypeValue;

	JoinType(int joinTypeValue) {
		this.joinTypeValue = joinTypeValue;
	}

	public int getJoinTypeValue() {
		return joinTypeValue;
	}

	public static JoinType parse(int joinType) {
		if ( joinType < 0 ) {
			return NONE;
		}
		switch ( joinType ) {
			case 0:
				return INNER_JOIN;
			case 1:
				return LEFT_OUTER_JOIN;
			case 2:
				return RIGHT_OUTER_JOIN;
			case 4:
				return FULL_JOIN;
			default:
				throw new HibernateException( "unknown join type: " + joinType );
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy