I have following settings in my persistence.xml, but still data isn't there.

<properties>
            <property name="javax.persistence.jdbc.driver" 
value="org.h2.Driver" />
            <property name="javax.persistence.jdbc.url" 
value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE" />
            <property name="javax.persistence.jdbc.user" value="sa" />
            <property name="javax.persistence.jdbc.password" value="" />

            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.hbm2ddl.auto" value="create" />
        </properties>

Thanks.


On Tuesday, March 27, 2012 4:44:31 PM UTC+5:30, steve.ebersole wrote:
>
> Hey Noel, you might want to read through 
> http://www.h2database.com/html/features.html#in_memory_databases
>
> By default, closing the last connection to a database closes the database. 
>> For an in-memory database, this means the content is lost. To keep the 
>> database open, add ;DB_CLOSE_DELAY=-1 to the database URL. To keep the 
>> content of an in-memory database as long as the virtual machine is alive, 
>> use jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
>
>
>
> On Tuesday, March 27, 2012 3:43:30 AM UTC-5, Noel Grandin wrote:
>>
>> On 2012-03-27 00:06, steve.ebersole wrote:
>> >
>> > Note that this is NOT using H2 JTA/XA support.  It is simply using H2 
>> > connections obtained via DriverManager wrapped in an Enhydra 
>> > DataSource.  The url is 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE'.
>> >
>> > Anyone see anything obvious?  If it weren't for the 
>> > 'DB_CLOSE_DELAY=-1', I would think the problem was the data cache 
>> > being dropped across the multiple connections.  That or somehow the 
>> > commit call on the connection is not being handled properly.
>> >
>> Do you realise your URL says to __negative__ one seconds for the close 
>> delay?
>> That means that the moment that the last connection closes, the DB will 
>> be destroyed.
>>
>> I think you should be using __positive__ one seconds, and I've added 
>> some code to the next version of H2 to catch such mistakes i.e. 
>> DB_CLOSE_DELAY must be >= 0
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/8bKJlxErumQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to