Dear Jena users,
I need an advice on whether to use transactional TDB or
non-transactional one, and if I use non-transactional; when to use TDB.sync.
As far as I understand from the tutorials, if I have never call a
transaction operation on a dataset (i.e. dataset.begin(..)), then my TDB
backed dataset is used in a non-transactional mode. With this kind of
usage, I think I need to properly sync database in order not to put the
data files into an inconsistent state. I hope I am correct up to this point.
I have a web application which uses Jena TDB as its data store. Multiple
users are signin-in in and manipulating data. My current problem is
that, if the JVM holding the servlet container shuts down (i.e. ctrl+c
command), and if I run the server again, then I get a
NullPointerException during the dataset creation:
"TDBFactory.createDataset(...);". I tried to avoid this exception with
TDB.sync after each write operation that I do, however this decreases
the performance a lot.
I can afford some missing information in the persistent store, however
the store becomes unreadable if closed (actually the JVM shuts down)
without a TDB.sync. On the other hand switching to transactional TDB
means that I need to employ a different architecture which will cost
much to me. To illustrate I want to give a small example, my bean-like
classes all extend OntClassImpl, hence in their constructors I call
"super(node, graph);" which automatically adds the corresponding triples
to my graph. It will be hard to edit this architecture to insert the
begin and end parts of transactions.
Any kind of advice is appreciated :)
Anil Sinaci.