Home  >  Hibernate

@Lob in Hibernate Annotation

By Arvind Rai, May 13, 2013
@Lob saves the data in BLOB or CLOB. Letís understand what is BLOB and CLOB

CLOB(Character Large Object): If data is text and is not enough to save in VARCHAR, then that data should be saved in CLOB.

BLOB(Binary Large Object): In case of double byte character large data is saved in BLOB data type.

In case of Character[],char[] and String data is saved in CLOB. And the data type Byte[], byte[] will be stored in BLOB.

Data.java
package com.concretepage.persistence;
import javax.persistence.Entity;
import javax.persistence.Lob;

@Entity
public class Data {
	@Lob
	private Character[] charData;
	
	@Lob
	private Byte[] byteData;

	public Character[] getCharData() {
		return charData;
	}
	public void setCharData(Character[] charData) {
		this.charData = charData;
	}

	public Byte[] getByteData() {
		return byteData;
	}

	public void setByteData(Byte[] byteData) {
		this.byteData = byteData;
	}
	
}
 
POSTED BY
ARVIND RAI
ARVIND RAI
FIND MORE TUTORILAS






©2019 concretepage.com | Privacy Policy | Contact Us