de.greenrobot.dao.DaoException Java Examples

The following examples show how to use de.greenrobot.dao.DaoException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: operators.java    From RxJavaApp with Apache License 2.0 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public alloperators getAlloperators() {
    Long __key = this.outer_id;
    if (alloperators__resolvedKey == null || !alloperators__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        alloperatorsDao targetDao = daoSession.getAlloperatorsDao();
        alloperators alloperatorsNew = targetDao.load(__key);
        synchronized (this) {
            alloperators = alloperatorsNew;
        	alloperators__resolvedKey = __key;
        }
    }
    return alloperators;
}
 
Example #2
Source File: Statistics.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public Challenge getStatistic() {
    long __key = this.challengeId;
    if (statistic__resolvedKey == null || !statistic__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        ChallengeDao targetDao = daoSession.getChallengeDao();
        Challenge statisticNew = targetDao.load(__key);
        synchronized (this) {
            statistic = statisticNew;
        	statistic__resolvedKey = __key;
        }
    }
    return statistic;
}
 
Example #3
Source File: Completion.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public Challenge getChallenge() {
    long __key = this.challengeId;
    if (challenge__resolvedKey == null || !challenge__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        ChallengeDao targetDao = daoSession.getChallengeDao();
        Challenge challengeNew = targetDao.load(__key);
        synchronized (this) {
            challenge = challengeNew;
        	challenge__resolvedKey = __key;
        }
    }
    return challenge;
}
 
Example #4
Source File: Message.java    From android-orm-benchmark with Apache License 2.0 6 votes vote down vote up
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
public List<User> getReaders() {
    if (readers == null) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        UserDao targetDao = daoSession.getUserDao();
        List<User> readersNew = targetDao._queryMessage_Readers(id);
        synchronized (this) {
            if(readers == null) {
                readers = readersNew;
            }
        }
    }
    return readers;
}
 
Example #5
Source File: AddressItem.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public AddressBook getAddressBook() {
    Long __key = this.id;
    if (addressBook__resolvedKey == null || !addressBook__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        AddressBookDao targetDao = daoSession.getAddressBookDao();
        AddressBook addressBookNew = targetDao.load(__key);
        synchronized (this) {
            addressBook = addressBookNew;
        	addressBook__resolvedKey = __key;
        }
    }
    return addressBook;
}
 
Example #6
Source File: Challenge.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
public List<Answer> getAnswers() {
    if (answers == null) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        AnswerDao targetDao = daoSession.getAnswerDao();
        List<Answer> answersNew = targetDao._queryChallenge_Answers(id);
        synchronized (this) {
            if(answers == null) {
                answers = answersNew;
            }
        }
    }
    return answers;
}
 
Example #7
Source File: Category.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
public List<Challenge> getChallenges() {
    if (challenges == null) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        ChallengeDao targetDao = daoSession.getChallengeDao();
        List<Challenge> challengesNew = targetDao._queryCategory_Challenges(id);
        synchronized (this) {
            if(challenges == null) {
                challenges = challengesNew;
            }
        }
    }
    return challenges;
}
 
Example #8
Source File: User.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public Settings getSettings() {
    long __key = this.settingsId;
    if (settings__resolvedKey == null || !settings__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        SettingsDao targetDao = daoSession.getSettingsDao();
        Settings settingsNew = targetDao.load(__key);
        synchronized (this) {
            settings = settingsNew;
        	settings__resolvedKey = __key;
        }
    }
    return settings;
}
 
Example #9
Source File: Contact.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public AddressBook getAddressBook() {
    Long __key = this.id;
    if (addressBook__resolvedKey == null || !addressBook__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        AddressBookDao targetDao = daoSession.getAddressBookDao();
        AddressBook addressBookNew = targetDao.load(__key);
        synchronized (this) {
            addressBook = addressBookNew;
        	addressBook__resolvedKey = __key;
        }
    }
    return addressBook;
}
 
Example #10
Source File: User.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
public List<Completion> getCompletions() {
    if (completions == null) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        CompletionDao targetDao = daoSession.getCompletionDao();
        List<Completion> completionsNew = targetDao._queryUser_Completions(id);
        synchronized (this) {
            if(completions == null) {
                completions = completionsNew;
            }
        }
    }
    return completions;
}
 
Example #11
Source File: User.java    From BrainPhaser with GNU General Public License v3.0 6 votes vote down vote up
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
public List<Statistics> getStatistics() {
    if (statistics == null) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        StatisticsDao targetDao = daoSession.getStatisticsDao();
        List<Statistics> statisticsNew = targetDao._queryUser_Statistics(id);
        synchronized (this) {
            if(statistics == null) {
                statistics = statisticsNew;
            }
        }
    }
    return statistics;
}
 
Example #12
Source File: DbHelper.java    From octoandroid with GNU General Public License v3.0 6 votes vote down vote up
public PrinterDbEntity getPrinterFromDbByName(String name) {
    Query<PrinterDbEntity> query = mNameSearchQueryMap.get(name);
    if (query == null) {
        query = mPrinterDbEntityDao.queryBuilder()
                .where(PrinterDbEntityDao.Properties.Name.eq(name))
                .build();
        mNameSearchQueryMap.put(name, query);
    }

    try {
        synchronized (sLock) {
            // Need to call forCurrentThread or else it will throw DaoException
            return query.forCurrentThread().unique();
        }
    } catch (DaoException e) {
        return null; // Shouldn't happen
    }
}
 
Example #13
Source File: DbHelper.java    From octoandroid with GNU General Public License v3.0 6 votes vote down vote up
public PrinterDbEntity getPrinterFromDbById(long printerId) {
    Query<PrinterDbEntity> query = mIdSearchQueryMap.get(printerId);
    if (query == null) {
        query = mPrinterDbEntityDao.queryBuilder()
                .where(PrinterDbEntityDao.Properties.Id.eq(printerId))
                .build();
        mIdSearchQueryMap.put(printerId, query);
    }
    try {
        synchronized (sLock) {
            // Need to call forCurrentThread or else it will throw DaoException
            return query.forCurrentThread().unique();
        }
    } catch (DaoException e) {
        return null; // Shouldn't happen
    }
}
 
Example #14
Source File: CollectEntity.java    From MeiZiNews with MIT License 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public HtmlEntity getHtmlEntity() {
    Long __key = this.html_id;
    if (htmlEntity__resolvedKey == null || !htmlEntity__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        HtmlEntityDao targetDao = daoSession.getHtmlEntityDao();
        HtmlEntity htmlEntityNew = targetDao.load(__key);
        synchronized (this) {
            htmlEntity = htmlEntityNew;
        	htmlEntity__resolvedKey = __key;
        }
    }
    return htmlEntity;
}
 
Example #15
Source File: AddressBook.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
public Collection<Contact> getContactList() {
    if (contactList == null) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        ContactDao targetDao = daoSession.getContactDao();
        List<Contact> contactListNew = targetDao._queryAddressBook_ContactList(id);
        synchronized (this) {
            if(contactList == null) {
                contactList = contactListNew;
            }
        }
    }
    return contactList;
}
 
Example #16
Source File: AddressBook.java    From AndroidDatabaseLibraryComparison with MIT License 6 votes vote down vote up
/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
public Collection<AddressItem> getAddressItemList() {
    if (addressItemList == null) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        AddressItemDao targetDao = daoSession.getAddressItemDao();
        List<AddressItem> addressItemListNew = targetDao._queryAddressBook_AddressItemList(id);
        synchronized (this) {
            if(addressItemList == null) {
                addressItemList = addressItemListNew;
            }
        }
    }
    return addressItemList;
}
 
Example #17
Source File: alloperators.java    From RxJavaApp with Apache License 2.0 6 votes vote down vote up
/** To-one relationship, resolved on first access. */
public operators getOperators() {
    Long __key = this.operators_id;
    if (operators__resolvedKey == null || !operators__resolvedKey.equals(__key)) {
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        operatorsDao targetDao = daoSession.getOperatorsDao();
        operators operatorsNew = targetDao.load(__key);
        synchronized (this) {
            operators = operatorsNew;
        	operators__resolvedKey = __key;
        }
    }
    return operators;
}
 
Example #18
Source File: CollectEntity.java    From MeiZiNews with MIT License 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
public void update() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.update(this);
}
 
Example #19
Source File: AddressItem.java    From AndroidDatabaseLibraryComparison with MIT License 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
public void update() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.update(this);
}
 
Example #20
Source File: DaoConfig.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private static Property[] reflectProperties(Class class1)
{
    Field afield[] = Class.forName((new StringBuilder()).append(class1.getName()).append("$Properties").toString()).getDeclaredFields();
    ArrayList arraylist = new ArrayList();
    int i = afield.length;
    for (int j = 0; j < i; j++)
    {
        Field field = afield[j];
        if ((9 & field.getModifiers()) != 9)
        {
            continue;
        }
        Object obj = field.get(null);
        if (obj instanceof Property)
        {
            arraylist.add((Property)obj);
        }
    }

    Property aproperty[] = new Property[arraylist.size()];
    for (Iterator iterator = arraylist.iterator(); iterator.hasNext();)
    {
        Property property = (Property)iterator.next();
        if (aproperty[property.ordinal] != null)
        {
            throw new DaoException("Duplicate property ordinals");
        }
        aproperty[property.ordinal] = property;
    }

    return aproperty;
}
 
Example #21
Source File: AddressBook.java    From AndroidDatabaseLibraryComparison with MIT License 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
public void refresh() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.refresh(this);
}
 
Example #22
Source File: AddressItem.java    From AndroidDatabaseLibraryComparison with MIT License 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
public void delete() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.delete(this);
}
 
Example #23
Source File: AddressBook.java    From AndroidDatabaseLibraryComparison with MIT License 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
public void update() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.update(this);
}
 
Example #24
Source File: AddressBook.java    From AndroidDatabaseLibraryComparison with MIT License 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
public void delete() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.delete(this);
}
 
Example #25
Source File: SqlUtils.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public static String createSqlSelect(String s, String s1, String as[])
{
    StringBuilder stringbuilder = new StringBuilder("SELECT ");
    if (s1 == null || s1.length() < 0)
    {
        throw new DaoException("Table alias required");
    } else
    {
        appendColumns(stringbuilder, s1, as).append(" FROM ");
        stringbuilder.append(s).append(' ').append(s1).append(' ');
        return stringbuilder.toString();
    }
}
 
Example #26
Source File: AsyncOperation.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public long getDuration()
{
    if (timeCompleted == 0L)
    {
        throw new DaoException("This operation did not yet complete");
    } else
    {
        return timeCompleted - timeStarted;
    }
}
 
Example #27
Source File: Message.java    From android-orm-benchmark with Apache License 2.0 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
public void delete() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.delete(this);
}
 
Example #28
Source File: Message.java    From android-orm-benchmark with Apache License 2.0 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
public void update() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.update(this);
}
 
Example #29
Source File: Message.java    From android-orm-benchmark with Apache License 2.0 5 votes vote down vote up
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
public void refresh() {
    if (myDao == null) {
        throw new DaoException("Entity is detached from DAO context");
    }    
    myDao.refresh(this);
}
 
Example #30
Source File: AbstractQuery.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
protected void checkThread()
{
    if (Thread.currentThread() != ownerThread)
    {
        throw new DaoException("Method may be called only in owner thread, use forCurrentThread to get an instance for this thread");
    } else
    {
        return;
    }
}