我RecordStore
用来存储我的数据。
我知道当我们将数据存储在 中时RecordStore
,它会自动为每条记录生成一个记录 ID。
但是我怎样才能自己设置记录ID呢?或者我怎样才能得到记录ID?
因为我想用这个recordstore.setRecord(..)
方法来更新我的记录库。
但是当我RecordEnumeration
用来获取RecordStore
和使用方法nextRecordId()
时,它只显示奇数或偶数 id。我的意思是当我有 8 条记录时,它只会打印出奇数或偶数记录,例如
2 4 6 8
我的代码:
handleRecord.openRecordStore(handleRecord.getRecordName());
RecordEnumeration re;
try {
int rc = handleRecord.getRecordStore().getNumRecords();
re = hrs.getRcs().enumerateRecords(null, null, true);
while(re.hasNextElement()) {
int rid = re.nextRecordId();
System.out.println(rid);
}
} catch(Exception e) {
System.out.println(e.toString());
}