本文整理汇总了Java中org.greenrobot.greendao.DaoException类的典型用法代码示例。如果您正苦于以下问题:Java DaoException类的具体用法?Java DaoException怎么用?Java DaoException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DaoException类属于org.greenrobot.greendao包,在下文中一共展示了DaoException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOptionList
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 1773152342)
public List<Option> getOptionList() {
if (optionList == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
OptionDao targetDao = daoSession.getOptionDao();
List<Option> optionListNew = targetDao._queryQuestion_OptionList(id);
synchronized (this) {
if (optionList == null) {
optionList = optionListNew;
}
}
}
return optionList;
}
示例2: buildDelete
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* Builds a reusable query object for deletion (Query objects can be executed more efficiently than creating a
* QueryBuilder for each execution.
*/
public DeleteQuery<T> buildDelete() {
if (!joins.isEmpty()) {
throw new DaoException("JOINs are not supported for DELETE queries");
}
String tablename = dao.getTablename();
String baseSql = SqlUtils.createSqlDelete(tablename, null);
StringBuilder builder = new StringBuilder(baseSql);
// tablePrefix gets replaced by table name below. Don't use tableName here because it causes trouble when
// table name ends with tablePrefix.
appendJoinsAndWheres(builder, tablePrefix);
String sql = builder.toString();
// Remove table aliases, not supported for DELETE queries.
// TODO(?): don't create table aliases in the first place.
sql = sql.replace(tablePrefix + ".\"", '"' + tablename + "\".\"");
checkLog(sql);
return DeleteQuery.create(dao, sql, values.toArray());
}
示例3: getMeasure
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/** To-one relationship, resolved on first access. */
@Generated(hash = 1530824084)
public Measure getMeasure() {
long __key = this.measure_id;
if (measure__resolvedKey == null || !measure__resolvedKey.equals(__key)) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
MeasureDao targetDao = daoSession.getMeasureDao();
Measure measureNew = targetDao.load(__key);
synchronized (this) {
measure = measureNew;
measure__resolvedKey = __key;
}
}
return measure;
}
示例4: count
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/** Returns the count (number of results matching the query). Uses SELECT COUNT (*) sematics. */
public long count() {
checkThread();
Cursor cursor = dao.getDatabase().rawQuery(sql, parameters);
try {
if (!cursor.moveToNext()) {
throw new DaoException("No result for count");
} else if (!cursor.isLast()) {
throw new DaoException("Unexpected row count: " + cursor.getCount());
} else if (cursor.getColumnCount() != 1) {
throw new DaoException("Unexpected column count: " + cursor.getColumnCount());
}
return cursor.getLong(0);
} finally {
cursor.close();
}
}
示例5: reflectProperties
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
private static Property[] reflectProperties(Class<? extends AbstractDao<?, ?>> daoClass)
throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException {
Class<?> propertiesClass = Class.forName(daoClass.getName() + "$Properties");
Field[] fields = propertiesClass.getDeclaredFields();
ArrayList<Property> propertyList = new ArrayList<Property>();
final int modifierMask = Modifier.STATIC | Modifier.PUBLIC;
for (Field field : fields) {
// There might be other fields introduced by some tools, just ignore them (see issue #28)
if ((field.getModifiers() & modifierMask) == modifierMask) {
Object fieldValue = field.get(null);
if (fieldValue instanceof Property) {
propertyList.add((Property) fieldValue);
}
}
}
Property[] properties = new Property[propertyList.size()];
for (Property property : propertyList) {
if (properties[property.ordinal] != null) {
throw new DaoException("Duplicate property ordinals");
}
properties[property.ordinal] = property;
}
return properties;
}
示例6: getGradeList
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 1040074549)
public List<Grade> getGradeList() {
if (gradeList == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
GradeDao targetDao = daoSession.getGradeDao();
List<Grade> gradeListNew = targetDao._queryAccount_GradeList(id);
synchronized (this) {
if (gradeList == null) {
gradeList = gradeListNew;
}
}
}
return gradeList;
}
示例7: getLocation
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-one relationship, resolved on first access.
*/
@Generated(hash = 1847191610)
public Location getLocation() {
Long __key = this.locationID;
if (location__resolvedKey == null || !location__resolvedKey.equals(__key)) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
LocationDao targetDao = daoSession.getLocationDao();
Location locationNew = targetDao.load(__key);
synchronized (this) {
location = locationNew;
location__resolvedKey = __key;
}
}
return location;
}
示例8: getLessons
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 1552857303)
public List<Lesson> getLessons() {
if (lessons == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
LessonDao targetDao = daoSession.getLessonDao();
List<Lesson> lessonsNew = targetDao._queryDay_Lessons(id);
synchronized (this) {
if (lessons == null) {
lessons = lessonsNew;
}
}
}
return lessons;
}
示例9: getOrders
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 1084217201)
public List<Order> getOrders() {
if (orders == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
OrderDao targetDao = daoSession.getOrderDao();
List<Order> ordersNew = targetDao._queryCustomer_Orders(id);
synchronized (this) {
if (orders == null) {
orders = ordersNew;
}
}
}
return orders;
}
示例10: getRule
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/** To-one relationship, resolved on first access. */
@Generated(hash = 752533316)
public CustomRules getRule() {
long __key = this.rule_id;
if (rule__resolvedKey == null || !rule__resolvedKey.equals(__key)) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
CustomRulesDao targetDao = daoSession.getCustomRulesDao();
CustomRules ruleNew = targetDao.load(__key);
synchronized (this) {
rule = ruleNew;
rule__resolvedKey = __key;
}
}
return rule;
}
示例11: getGenres
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 1620741698)
public List<GenreModel> getGenres() {
if (genres == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
GenreModelDao targetDao = daoSession.getGenreModelDao();
List<GenreModel> genresNew = targetDao._queryMovieOverviewModel_Genres(id);
synchronized (this) {
if (genres == null) {
genres = genresNew;
}
}
}
return genres;
}
示例12: getCast
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 150995885)
public List<CastRelationModel> getCast() {
if (cast == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
CastRelationModelDao targetDao = daoSession.getCastRelationModelDao();
List<CastRelationModel> castNew = targetDao._queryMovieOverviewModel_Cast(id);
synchronized (this) {
if (cast == null) {
cast = castNew;
}
}
}
return cast;
}
示例13: getCrew
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 1914797064)
public List<CrewRelationModel> getCrew() {
if (crew == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
CrewRelationModelDao targetDao = daoSession.getCrewRelationModelDao();
List<CrewRelationModel> crewNew = targetDao._queryMovieOverviewModel_Crew(id);
synchronized (this) {
if (crew == null) {
crew = crewNew;
}
}
}
return crew;
}
示例14: getSubjectList
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/**
* To-many relationship, resolved on first access (and after reset).
* Changes to to-many relations are not persisted, make changes to the target entity.
*/
@Generated(hash = 1800750450)
public List<Subject> getSubjectList() {
if (subjectList == null) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
SubjectDao targetDao = daoSession.getSubjectDao();
List<Subject> subjectListNew = targetDao._queryAccount_SubjectList(id);
synchronized (this) {
if (subjectList == null) {
subjectList = subjectListNew;
}
}
}
return subjectList;
}
示例15: getMovie
import org.greenrobot.greendao.DaoException; //导入依赖的package包/类
/** To-one relationship, resolved on first access. */
@Generated(hash = 1289461985)
public MovieOverviewModel getMovie() {
long __key = this.movieId;
if (movie__resolvedKey == null || !movie__resolvedKey.equals(__key)) {
final DaoSession daoSession = this.daoSession;
if (daoSession == null) {
throw new DaoException("Entity is detached from DAO context");
}
MovieOverviewModelDao targetDao = daoSession.getMovieOverviewModelDao();
MovieOverviewModel movieNew = targetDao.load(__key);
synchronized (this) {
movie = movieNew;
movie__resolvedKey = __key;
}
}
return movie;
}