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; /* ww w . j ava 2s .co 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.PlaceUnit; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table PLACE_UNIT. */ public class PlaceUnitDao extends AbstractDao<PlaceUnit, Long> { public static final String TABLENAME = "PLACE_UNIT"; /** * Properties of entity PlaceUnit.<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 UnitId = new Property(1, Long.class, "unitId", false, "UNIT_ID"); public final static Property PlaceId = new Property(2, Long.class, "placeId", false, "PLACE_ID"); }; private Query<PlaceUnit> unit_PlaceUnitListQuery; private Query<PlaceUnit> place_PlaceUnitListQuery; public PlaceUnitDao(DaoConfig config) { super(config); } public PlaceUnitDao(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_UNIT' (" + // "'_id' INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "'UNIT_ID' INTEGER," + // 1: unitId "'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_UNIT'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, PlaceUnit entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } Long unitId = entity.getUnitId(); if (unitId != null) { stmt.bindLong(2, unitId); } 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 PlaceUnit readEntity(Cursor cursor, int offset) { PlaceUnit entity = new PlaceUnit( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // unitId cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2) // placeId ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, PlaceUnit entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setUnitId(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(PlaceUnit entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(PlaceUnit entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } /** Internal query to resolve the "placeUnitList" to-many relationship of Unit. */ public List<PlaceUnit> _queryUnit_PlaceUnitList(Long unitId) { synchronized (this) { if (unit_PlaceUnitListQuery == null) { QueryBuilder<PlaceUnit> queryBuilder = queryBuilder(); queryBuilder.where(Properties.UnitId.eq(null)); unit_PlaceUnitListQuery = queryBuilder.build(); } } Query<PlaceUnit> query = unit_PlaceUnitListQuery.forCurrentThread(); query.setParameter(0, unitId); return query.list(); } /** Internal query to resolve the "placeUnitList" to-many relationship of Place. */ public List<PlaceUnit> _queryPlace_PlaceUnitList(Long placeId) { synchronized (this) { if (place_PlaceUnitListQuery == null) { QueryBuilder<PlaceUnit> queryBuilder = queryBuilder(); queryBuilder.where(Properties.PlaceId.eq(null)); place_PlaceUnitListQuery = queryBuilder.build(); } } Query<PlaceUnit> query = place_PlaceUnitListQuery.forCurrentThread(); query.setParameter(0, placeId); return query.list(); } }