alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (JoinType.java)

This example Hibernate source code file (JoinType.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

full_join, hibernateexception, inner_join, jointype, jointype, left_outer_join, left_outer_join, none, none, right_outer_join, right_outer_join

The Hibernate JoinType.java source code

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 );
		}
	}
}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate JoinType.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.