db.configureIndex(Record.class, "strKey", true); won't work.
You will get an exception looking something like this:
com.mobixess.jodb.core.JodbIOException: can't find description for primitive java.lang.String com.mobixess.jodb.util.PrimitiveJavaTypesUtil.getEnumeratedType(PrimitiveJavaTypesUtil.java:141) com.mobixess.jodb.core.index.JODBIndexingAgent.(JODBIndexingAgent.java:73) com.mobixess.jodb.core.index.JODBIndexingRootAgent.addAgent(JODBIndexingRootAgent.java:148) com.mobixess.jodb.core.index.JODBIndexingRootAgent.enableIndex(JODBIndexingRootAgent.java:72) com.mobixess.jodb.core.JODBSessionContainer.configureIndex(JODBSessionContainer.java:130) com.mobixess.jodb.core.JODBSessionContainer.configureIndex(JODBSessionContainer.java:102)
Another thing you must watch out for is when you are deleting your object from the database, you should(must at least when they contain other stuff than primitives) deactivate them, before, deleting them.
Record r = set.next(); db.deactivate(r, 1); db.delete(r);If you do not do this you will get an exception from deep within the Apache harmoney classes, in mmap method.
java.io.IOException org.apache.harmony.luni.platform.OSMemory.mmap(OSMemory.java:617) org.apache.harmony.luni.platform.PlatformAddressFactory.allocMapPlatformAddressFactory.java:107) org.apache.harmony.nio.internal.FileChannelImpl.mapImpl(FileChannelImpl.java:201) org.apache.harmony.nio.internal.ReadWriteFileChannel.map(ReadWriteFileChannel.java:53) org.apache.harmony.nio.internal.FileChannelImpl.transferFrom(FileChannelImpl.java:422) com.mobixess.jodb.core.io.buffers.RandomAccessFileTransactionBuffer.transferFrom(RandomAccessFileTransactionBuffer.java:156) com.mobixess.jodb.core.io.JODBIOBase.applyTransaction0(JODBIOBase.java:501) com.mobixess.jodb.core.io.JODBIOBase.applyTransaction0(JODBIOBase.java:433) com.mobixess.jodb.core.io.JODBIOBase.applyTransaction(JODBIOBase.java:336) com.mobixess.jodb.core.JODBSessionContainer.commit(JODBSessionContainer.java:202 com.mobixess.jodb.core.JODBSessionContainer.commit(JODBSessionContainer.java:191)
So now I got a working TestIndex for JODB, so soon I'll hopefully have some results on the emulator and on the ADP1. The biggest problem I found with using JODB is the lack of documentation, so if you're considering using it you should be aware that it's not that much help to get.
you have a nice site. thanks for sharing this site. there are various kinds of ebooks are available here
ReplyDeletehttp://feboook.blogspot.com