Article From:https://www.cnblogs.com/longsanshi/p/9122745.html
import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Lob; import javax.persistence.Transient; import org.hibernate.bytecode.internal.javassist.FieldHandled; import org.hibernate.bytecode.internal.javassist.FieldHandler; import com.fasterxml.jackson.annotation.JsonIgnore; import com.ycsys.business.entity.base.TemporalEntity; /** * Created by ll on 2017/12/15. */ @Entity public class AnimalScience2 implements FieldHandled { @Lob @Basic(fetch = FetchType.LAZY) @Column(name="detail") private String detail; //Graph and text alternation type content (with text editor) public String getDetail() { if (fieldHandler != null) { return (String) fieldHandler.readObject(this, "detail ", detail); } return null; } public void setDetail(String detail) { if(fieldHandler!=null){ fieldHandler.writeObject(this, "detail", this.detail, detail); return; } this.detail = detail; } @Transient private FieldHandler fieldHandler;//It does not require this technology to delay the loading of table fields and associate objects with lazy loading. @JsonIgnore public FieldHandler getFieldHandler() { return fieldHandler; } public void setFieldHandler(FieldHandler fieldHandler) { this.fieldHandler = fieldHandler; } }
The above is the lazy loading of detail
Reference: https://blog.csdn.net/qq804702802/article/details/49279065
Link of this Article: Lazy loading implementation of non mapping attributes of large fields in JPA