On Jun 24, 2009, at 3:52 PM, Niclas Hedhman wrote:
On Wed, Jun 24, 2009 at 7:20 PM, Mads Brøgger
Enevoldsen<[email protected]> wrote:
Hi.
I'm trying to use JDBM for persistence. It is working except that
whenever
you restart the application, the data is overwritten. It seems like a
"create-drop" setting for it.
The assembler code:
module.addServices(JdbmEntityStoreService.class,
UuidIdentityGeneratorService
.class).visibleIn(Visibility.application);
The activation:
public void activate() throws Exception
{
UnitOfWork uow =
uowf.newUnitOfWork(UsecaseBuilder.newUsecase("Service
configuration"));
String jdbmPath = new File(config.dataDirectory(),
"streamflow").getAbsolutePath();
uow.newEntity(JdbmConfiguration.class,
"JdbmEntityStoreService").file().set(jdbmPath);
uow.complete();
}
What activation code is this? You typically don't create the
Configuration in your own code.
Instead you create a properties file with the same name as the Service
instance's identifiedBy() (defaults to Service class name). The
Configuration subsystem takes care of the rest.
Yes. We do have a
org.qi4j.entitystore.jdbm.JdbmEntityStoreService.properties file which
sets the file name of the persistance file. The only reason for this
activation code is to override the file location (because it changes
depending on the platform). This could probably be solved in another
way.
So If I remove the activation code it just uses the file as defined in
the org.qi4j.entitystore.jdbm.JdbmEntityStoreService.properties file.
BUT the outcome is still the same: whenever I restart the application,
if re-writes the file and all my previous data is lost.
Regards,
Mads
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev