![]() |
![]() |
|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 11
|
|
| Author |
|
|
Newbie Joined: Jul 8, 2008 Post Count: 15 Status: Offline |
Dear all, I am running the sample from datanucleus website and everything seems to work well... Nevertheles whenever I run the application the old database is deleted and a new one is created even if I avoid to run the enhance,createSchema,deleteSchema tasks. How is it possible to save the database (HSQL) without loosing my stored info? Thanks in advance, /Maria |
||
|
|
Expert Joined: Nov 16, 2005 Post Count: 804 Status: Offline |
Dear all, I am running the sample from datanucleus website and everything seems to work well... Nevertheles whenever I run the application the old database is deleted and a new one is created even if I avoid to run the enhance,createSchema,deleteSchema tasks. How is it possible to save the database (HSQL) without loosing my stored info? Thanks in advance, /Maria What's the URL of the database ? (I suspect that you are using an in-memory version) Guido ---------------------------------------- Guido Anzuoni http://www.objectmagic.org |
||
|
|
Newbie Joined: Jul 8, 2008 Post Count: 15 Status: Offline |
Dear all, I am running the sample from datanucleus website and everything seems to work well... Nevertheles whenever I run the application the old database is deleted and a new one is created even if I avoid to run the enhance,createSchema,deleteSchema tasks. How is it possible to save the database (HSQL) without loosing my stored info? Thanks in advance, /Maria What's the URL of the database ? (I suspect that you are using an in-memory version) Guido Indeed, I'm using an in-memory version My properties file is the following: javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:assist javax.jdo.option.ConnectionUserName=sa javax.jdo.option.ConnectionPassword= datanucleus.autoCreateSchema=true datanucleus.validateTables=false datanucleus.validateConstraints=false Thanks, /Maria |
||
|
|
Newbie Joined: Dec 30, 2009 Post Count: 4 Status: Offline |
Sorry for opening such an old thread again, but I have a similar problem: I specified the following url: javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:db/timefinder and datanucleus.autoCreateSchema=true So I guessed that the schema is created once and the number of persons will increase if I create one person per run and commit this. But the schema seems to be deleted on every startup, because if I specify datanucleus.autoCreateSchema=false I get: Required table missing : "PERSON" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. The same is true if I use the h2 database. What is my mistake? |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5235 Status: Offline |
DataNucleus doesn't delete any tables ... ever. The only thing that can do that is the datastore itself, e.g when using embedded. The DataNucleus log tells you everything that it does. The docs for HSQLDB would be the point of reference for what it would do in that particular case ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Newbie Joined: Dec 30, 2009 Post Count: 4 Status: Offline |
Thanks for the hint! I figured it out: I need to use shutdown=true javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:db/timefinder;shutdown=true see http://hsqldb.org/doc/guide/ch01.html But with that in mind I can imagine that hsqldb is not really ACID conform!? And now I need a 'deleteAll' method for my test cases. Should I do this via Extent e = pm.getExtent(Person.class, true); Query query = pm.newQuery(e); query.deletePersistentAll(); for all classes or recreate the schema with the schematool? Or is there even a better/faster approach? |
||
|
|
Expert Belgium Joined: Mar 12, 2004 Post Count: 3105 Status: Offline |
In our test cases we delete the objects as your example, which ensures that we have full awareness of what is inserted or deleted from database. ---------------------------------------- Erik Bengtson ![]() |
||
|
|
Newbie Germany Joined: Jan 10, 2010 Post Count: 14 Status: Offline |
Could someone please confirm that the solution described above really works? I have the same problem with HSQL although I followed the above advice. I even added a final pmf.close() to the code and deleted the portion of the code which removes all stored objects from the database. My properties are: But after running the code no database file is written. The exact same code works perfectly with postgresql (with adjusted properties of course). So what can still be wrong in my setup here? lg Michael |
||
|
|
Newbie Joined: Dec 30, 2009 Post Count: 4 Status: Offline |
My property file is: javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory # H2 #javax.jdo.option.ConnectionDriverName=org.h2.Driver #javax.jdo.option.ConnectionURL=jdbc:h2:db/timefinder # HSQLDB javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:db/timefinder;shutdown=true #javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:timefinder javax.jdo.option.ConnectionUserName=sa javax.jdo.option.ConnectionPassword= datanucleus.autoCreateSchema=true datanucleus.validateTables=false datanucleus.validateConstraints=false |
||
|
|
Newbie Germany Joined: Jan 10, 2010 Post Count: 14 Status: Offline |
So it works for you with basically the same settings that I have? |
||
|
|
|
|
|
Current timezone is GMT Mar 17, 2010 1:56:42 AM |