
sf.core.LazyLoadUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sorm Show documentation
Show all versions of sorm Show documentation
java jpa tool for spring
The newest version!
package sf.core;
import sf.database.dao.DBClient;
import sf.database.dao.DBContext;
import sf.database.jdbc.sql.Crud;
public class LazyLoadUtils {
/**
* 加载子对象
* @param client client
* @param object 对象
* @param fieldName 级联字段
*/
public static void loadCascadeObject(DBClient client, DBContext context, DBObject object, String fieldName) {
if (context != null) {
context.setUseLazyLoad(false);
client.useContext(context);
}
client.executeFunc(connection -> Crud.getInstance().getCrudModel().fetchLinks(connection, object, fieldName));
}
/**
* 设置延迟加载信息
* @param object 对象
* @param client db对象
* @param context 上下文 可为null
*/
public static void setLazyLoadContext(DBObject object, DBClient client, DBContext context) {
object.lazyload = new LazyLoadContext(client, context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy