/** Internal query to resolve the "toManyTargetEntityList" to-many relationship of ToManyEntity. */ public List<ToManyTargetEntity> _queryToManyEntity_ToManyTargetEntityList(Long toManyId) { synchronized (this) { if (toManyEntity_ToManyTargetEntityListQuery == null) { QueryBuilder<ToManyTargetEntity> queryBuilder = queryBuilder(); queryBuilder.where(Properties.ToManyId.eq(null)); queryBuilder.orderRaw("T.'_id' ASC"); toManyEntity_ToManyTargetEntityListQuery = queryBuilder.build(); } } Query<ToManyTargetEntity> query = toManyEntity_ToManyTargetEntityListQuery.forCurrentThread(); query.setParameter(0, toManyId); return query.list(); }
/** Internal query to resolve the "toManyByJoinProperty" to-many relationship of ToManyEntity. */ public List<ToManyTargetEntity> _queryToManyEntity_ToManyByJoinProperty(String targetJoinProperty) { synchronized (this) { if (toManyEntity_ToManyByJoinPropertyQuery == null) { QueryBuilder<ToManyTargetEntity> queryBuilder = queryBuilder(); queryBuilder.where(Properties.TargetJoinProperty.eq(null)); queryBuilder.orderRaw("T.'_id' ASC"); toManyEntity_ToManyByJoinPropertyQuery = queryBuilder.build(); } } Query<ToManyTargetEntity> query = toManyEntity_ToManyByJoinPropertyQuery.forCurrentThread(); query.setParameter(0, targetJoinProperty); return query.list(); }
/** Internal query to resolve the "toManyDescList" to-many relationship of ToManyEntity. */ public List<ToManyTargetEntity> _queryToManyEntity_ToManyDescList(Long toManyIdDesc) { synchronized (this) { if (toManyEntity_ToManyDescListQuery == null) { QueryBuilder<ToManyTargetEntity> queryBuilder = queryBuilder(); queryBuilder.where(Properties.ToManyIdDesc.eq(null)); queryBuilder.orderRaw("T.'_id' DESC"); toManyEntity_ToManyDescListQuery = queryBuilder.build(); } } Query<ToManyTargetEntity> query = toManyEntity_ToManyDescListQuery.forCurrentThread(); query.setParameter(0, toManyIdDesc); return query.list(); }
public void testOrderRaw() { ArrayList<TestEntity> inserted = insert(2); List<TestEntity> result = dao.queryBuilder().orderRaw(Properties.SimpleInteger.columnName + " ASC").list(); assertEquals(2, result.size()); assertEquals(inserted.get(0).getId(), result.get(0).getId()); result = dao.queryBuilder().orderRaw(Properties.SimpleInteger.columnName + " DESC").list(); assertEquals(2, result.size()); assertEquals(inserted.get(1).getId(), result.get(0).getId()); }
/** Internal query to resolve the "toManyJoinTwo" to-many relationship of ToManyEntity. */ public List<ToManyTargetEntity> _queryToManyEntity_ToManyJoinTwo(Long toManyId, String targetJoinProperty) { synchronized (this) { if (toManyEntity_ToManyJoinTwoQuery == null) { QueryBuilder<ToManyTargetEntity> queryBuilder = queryBuilder(); queryBuilder.where(Properties.ToManyId.eq(null)); queryBuilder.where(Properties.TargetJoinProperty.eq(null)); queryBuilder.orderRaw("T.'TARGET_JOIN_PROPERTY' DESC,T.'_id' DESC"); toManyEntity_ToManyJoinTwoQuery = queryBuilder.build(); } } Query<ToManyTargetEntity> query = toManyEntity_ToManyJoinTwoQuery.forCurrentThread(); query.setParameter(0, toManyId); query.setParameter(1, targetJoinProperty); return query.list(); }
/** Internal query to resolve the "messages" to-many relationship of Thread. */ public List<Message> _queryThread_Messages(Long threadId) { synchronized (this) { if (thread_MessagesQuery == null) { QueryBuilder<Message> queryBuilder = queryBuilder(); queryBuilder.where(Properties.ThreadId.eq(null)); queryBuilder.orderRaw("T.'DATE' ASC"); thread_MessagesQuery = queryBuilder.build(); } } Query<Message> query = thread_MessagesQuery.forCurrentThread(); query.setParameter(0, threadId); return query.list(); }