我有这个查询,在运行时来自调试检查:
SELECT columndata.* FROM columndata WHERE record_id IN (SELECT record_id FROM columndata WHERE columnmeta_id = 2 AND numeric_value = 777793989) ORDER BY ID
它返回16行。
我有此代码:
List<ColumnData> colData = ColumnData.findBySQL("SELECT columndata.* FROM columndata "
+ " WHERE record_id IN (SELECT record_id FROM columndata WHERE "
+ " columnmeta_id = " + "? AND numeric_value = ?) ORDER BY ID", pkColMetaId, pk);
colData为[]
,即它什么都没有映射。
以下是记录:
"ID"|"COLUMNMETA_ID"|"TABLEMETA_ID"|"RECORD_ID"|"STRING_VALUE"|"BLOB_VALUE"|"BOOLEAN_VALUE"|"NUMERIC_VALUE"|"DATE_VALUE"|"CREATED_AT"|"UPDATED_AT"
"2325"|"55"|"1"|"1220"|"97"|||||"2018-06-10 08:17:42.26"|"2018-06-10 08:19:08.225"
"2326"|"56"|"1"|"1220"|"121"|||||"2018-06-10 08:17:42.263"|"2018-06-10 08:18:31.777"
"2327"|"57"|"1"|"1220"|"1"|||||"2018-06-10 08:17:42.264"|"2018-06-10 08:18:22.629"
"2328"|"59"|"1"|"1220"|"Queen"|||||"2018-06-10 08:17:42.265"|"2018-06-10 08:18:41.101"
"2329"|"270"|"1"|"1220"|"Tyler"|||||"2018-06-10 08:17:42.266"|"2018-06-10 08:18:20.587"
"2330"|"1"|"1"|"1220"|"David's Project"|||||"2018-06-10 08:17:42.267"|"2018-06-11 18:10:26.841"
"2331"|"2"|"1"|"1220"||||"777793989"||"2018-06-10 08:17:42.268"|"2018-06-10 08:17:42.268"
"2332"|"3"|"1"|"1220"||||||"2018-06-10 08:17:42.268"|"2018-06-10 08:17:42.268"
"2333"|"4"|"1"|"1220"|||"TRUE"|||"2018-06-10 08:17:42.269"|"2019-01-27 15:11:44.651"
"2334"|"5"|"1"|"1220"|||"FALSE"|||"2018-06-10 08:17:42.27"|"2018-06-10 08:17:42.27"
"2335"|"238"|"1"|"1220"|||||"2018-06-30 00:00:00.0"|"2018-06-10 08:17:42.271"|"2018-06-10 08:19:00.776"
"2336"|"60"|"1"|"1220"||||||"2018-06-10 08:17:42.271"|"2018-06-10 08:17:42.271"
"2337"|"61"|"1"|"1220"|"Ret"|||||"2018-06-10 08:17:42.272"|"2018-06-10 08:19:06.413"
"2338"|"62"|"1"|"1220"||||||"2018-06-10 08:17:42.273"|"2018-06-10 08:17:42.273"
"2339"|"63"|"1"|"1220"|"3567"|||||"2018-06-10 08:17:42.274"|"2018-06-10 08:19:27.175"
"2340"|"64"|"1"|"1220"|||||"2018-06-10 00:00:00.0"|"2018-06-10 08:17:42.282"|"2018-06-11 18:10:49.678"
这是ColumnData类:
import org.javalite.activejdbc.Model;
import org.javalite.activejdbc.annotations.Table;
@Table(value = "COLUMNDATA")
public class ColumnData extends Model {
}
原因:
List<ColumnData> allCol = ColumnData.findAll();
返回所有709行
我也尝试使用ColumnData类注释中定义的大写字母
SELECT COLUMNDATA.* FROM COLUMNDATA WHERE RECORD_ID IN (SELECT RECORD_ID FROM COLUMNDATA WHERE COLUMNDATA_ID = ? AND NUMERIC_VALUE = ?) ORDER BY ID
结果相同
想法?