db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "P. Douglas Reeder" <reeder...@osu.edu>
Subject Forcing Data to Disk on JPA Commit
Date Wed, 12 Dec 2007 15:03:49 GMT
Sorry to ask such a basic question, but after all the manuals and the  
list archives for "cache" and googling for "derby write cache", I'm  
still stumped.

I've written a simple web application wherein users take a survey and  
the results are saved to a database, using the Persistence API. It  
runs in Sun's Java Application Server, using TopLink Essentials as  
the Persistence provider and Derby as the database, all running on a  
Fedora Core 3 system. The application runs and data does indeed get  
written to the Derby database, but not for a while, generally several  
transactions later. Obviously, the data is being cached, which is  
generally a good thing. However, when a power outage occurs, there's  
no time for the cache to be written to the database. Transactions  
that happened two weeks earlier were not written to the database, and  
we lost data, which seems silly under the circumstances. The server  
is very lightly loaded -- there's only a few transactions each week.

So, I need to make sure the cache is written to disk within a  
reasonable length of time. How can I either
1) force data to be written to disk after every transaction
2) force data to be written to disk within some fixed time?

I asked about this on the TopLink mailing list, and was told TopLink  
doesn't cache writes.

The only thing about write caching I found in the Derby manuals was:
but this must be called using the JDBC API:
CallableStatement cs = conn.prepareCall ("CALL  
but I don't think I have access to the connection variable when using  

(I did find out about the on-disk write cache, but that isn't enabled  
on the drive.)

Here's my persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/ 
persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http:// 
<persistence-unit name="OMSI-EE5cPersistenceUnit" transaction- 
<property name="toplink.ddl-generation" value="create-tables"/>

View raw message