title: h2 embedded database,javafx,hibernate
body: <p>Hello I am creating a desktop application using Javafx ,embedded h2 database and hibernate for making connection between them. My application running well in my desktop but while i am running the executable jar file on other system it unable to fetch data from data base that means  my db file is not embedded in application jar file. my database file resides in root directory .kindly tell me how can i put embedded h2 database file into that executable jar file or what change should i make in hibernate.cfg  to put my test.h2.db file in app.jar.</p>
  
  <pre><code>My hibernate.cfg file is 
  &lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;org.h2.Driver&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:h2:~/test&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;sa&lt;/property&gt;
      &lt;property name="hibernate.connection.password"/&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.H2Dialect&lt;/property&gt;
      &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
      &lt;property name="cache.provider_class"&gt;
              org.hibernate.cache.NoCacheProvider
          &lt;/property&gt;
      &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;
      &lt;property name="show_sql"&gt;true&lt;/property&gt;
      &lt;mapping class="model.Employee"/&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>