本文整理汇总了Java中com.j256.ormlite.misc.BaseDaoEnabled.setDao方法的典型用法代码示例。如果您正苦于以下问题:Java BaseDaoEnabled.setDao方法的具体用法?Java BaseDaoEnabled.setDao怎么用?Java BaseDaoEnabled.setDao使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.misc.BaseDaoEnabled
的用法示例。
在下文中一共展示了BaseDaoEnabled.setDao方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.j256.ormlite.misc.BaseDaoEnabled; //导入方法依赖的package包/类
@Override
public int create(T data) throws SQLException {
checkForInitialized();
// ignore creating a null object
if (data == null) {
return 0;
}
if (data instanceof BaseDaoEnabled) {
@SuppressWarnings("unchecked")
BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data;
daoEnabled.setDao(this);
}
DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName());
try {
return statementExecutor.create(connection, data, objectCache);
} finally {
connectionSource.releaseConnection(connection);
}
}
示例2: update
import com.j256.ormlite.misc.BaseDaoEnabled; //导入方法依赖的package包/类
@Override
public int update(T data) throws SQLException {
checkForInitialized();
// ignore updating a null object
if (data == null) {
return 0;
}
if (data instanceof BaseDaoEnabled) {
@SuppressWarnings("unchecked")
BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data;
daoEnabled.setDao(this);
}
DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName());
try {
return statementExecutor.update(connection, data, objectCache);
} finally {
connectionSource.releaseConnection(connection);
}
}
示例3: refresh
import com.j256.ormlite.misc.BaseDaoEnabled; //导入方法依赖的package包/类
@Override
public int refresh(T data) throws SQLException {
checkForInitialized();
// ignore refreshing a null object
if (data == null) {
return 0;
}
if (data instanceof BaseDaoEnabled) {
@SuppressWarnings("unchecked")
BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) data;
daoEnabled.setDao(this);
}
DatabaseConnection connection = connectionSource.getReadOnlyConnection(tableInfo.getTableName());
try {
return statementExecutor.refresh(connection, data, objectCache);
} finally {
connectionSource.releaseConnection(connection);
}
}
示例4: wireNewInstance
import com.j256.ormlite.misc.BaseDaoEnabled; //导入方法依赖的package包/类
private static <T, ID> void wireNewInstance(BaseDaoImpl<T, ID> baseDaoImpl, T instance) {
if (instance instanceof BaseDaoEnabled) {
@SuppressWarnings("unchecked")
BaseDaoEnabled<T, ID> daoEnabled = (BaseDaoEnabled<T, ID>) instance;
daoEnabled.setDao(baseDaoImpl);
}
}