I m parsing JSON from a services, using ORMLite to persistent Object to the database as Iread out. 这些档案可能非常庞大,因此,我认为是在阅读时发射物体,而不是读数以百计的物体以备记忆和进行大规模攻击(这在讲智能的人中是稀有的)。 然而,每个目标都将包含具有多种价值的收集(我试图为这些价值使用<代码>>ForeignCollection,因此每个数值都需作为单独目标处理),并且认为最好把所有物品一劳永逸地投在物体收集中,而不是在每一个人Sting或Integer上。
I believe that to make a group of commits in a batch, I would simply call dao.setAutoCommit(false)
, call dao.create()
for each item, call dao.commit()
afterwards and then call dao.setAutoCommit(true)
to go back to piecemeal commits.
我有三个问题:
- Is it right to commit as I go, or should I to a batch commit--even if it means up to a thousand objects would get committed at once?
- Is it better to commit the collection of items one at a time, or in a batch?
- Where do I get the
databaseConnection
value from thatdao.setAutoCommit()
anddao.commit()
require? Maybe I missed it, but I can t find it in the documentation or examples.