Back to project page campus.
The source code is released under:
GNU General Public License
If you think the Android project campus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package lecho.app.campus.dao; //from ww w .jav a 2s .c o m import java.util.List; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; import de.greenrobot.dao.AbstractDao; import de.greenrobot.dao.Property; import de.greenrobot.dao.internal.DaoConfig; import de.greenrobot.dao.query.Query; import de.greenrobot.dao.query.QueryBuilder; import lecho.app.campus.dao.PlaceCategory; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table PLACE_CATEGORY. */ public class PlaceCategoryDao extends AbstractDao<PlaceCategory, Long> { public static final String TABLENAME = "PLACE_CATEGORY"; /** * Properties of entity PlaceCategory.<br/> * Can be used for QueryBuilder and for referencing column names. */ public static class Properties { public final static Property Id = new Property(0, Long.class, "id", true, "_id"); public final static Property CategoryId = new Property(1, Long.class, "categoryId", false, "CATEGORY_ID"); public final static Property PlaceId = new Property(2, Long.class, "placeId", false, "PLACE_ID"); }; private Query<PlaceCategory> category_PlaceCategoryListQuery; private Query<PlaceCategory> place_PlaceCategoryListQuery; public PlaceCategoryDao(DaoConfig config) { super(config); } public PlaceCategoryDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(SQLiteDatabase db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "'PLACE_CATEGORY' (" + // "'_id' INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "'CATEGORY_ID' INTEGER," + // 1: categoryId "'PLACE_ID' INTEGER);"); // 2: placeId } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'PLACE_CATEGORY'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, PlaceCategory entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } Long categoryId = entity.getCategoryId(); if (categoryId != null) { stmt.bindLong(2, categoryId); } Long placeId = entity.getPlaceId(); if (placeId != null) { stmt.bindLong(3, placeId); } } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public PlaceCategory readEntity(Cursor cursor, int offset) { PlaceCategory entity = new PlaceCategory( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // categoryId cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2) // placeId ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, PlaceCategory entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setCategoryId(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1)); entity.setPlaceId(cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2)); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(PlaceCategory entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(PlaceCategory entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } /** Internal query to resolve the "placeCategoryList" to-many relationship of Category. */ public List<PlaceCategory> _queryCategory_PlaceCategoryList(Long categoryId) { synchronized (this) { if (category_PlaceCategoryListQuery == null) { QueryBuilder<PlaceCategory> queryBuilder = queryBuilder(); queryBuilder.where(Properties.CategoryId.eq(null)); category_PlaceCategoryListQuery = queryBuilder.build(); } } Query<PlaceCategory> query = category_PlaceCategoryListQuery.forCurrentThread(); query.setParameter(0, categoryId); return query.list(); } /** Internal query to resolve the "placeCategoryList" to-many relationship of Place. */ public List<PlaceCategory> _queryPlace_PlaceCategoryList(Long placeId) { synchronized (this) { if (place_PlaceCategoryListQuery == null) { QueryBuilder<PlaceCategory> queryBuilder = queryBuilder(); queryBuilder.where(Properties.PlaceId.eq(null)); place_PlaceCategoryListQuery = queryBuilder.build(); } } Query<PlaceCategory> query = place_PlaceCategoryListQuery.forCurrentThread(); query.setParameter(0, placeId); return query.list(); } }