Results 1 to 9 of 9

Thread: How a hypersonic db is created in Spring Life tutorial?

  1. #1
    Join Date
    Jul 2005
    Posts
    4

    Default How a hypersonic db is created in Spring Life tutorial?

    Hi,

    I have download "Spring Live" sample example in order to learn Spring framework.
    I did not understand and "ant deploy", how a hypersonic data base could be created. But it is the case.

    I checked target "deploy" and "compile", nowhere could I see the creation of database.

    Any explaination?

    Thanks!

    PY


    <target name="deploy" depends="compile" description="Deploy application">
    <copy todir="${tomcat.home}/webapps/${webapp.name}" preservelastmodified="true">
    <fileset dir="${web.dir}">
    <include name="**/*.*" />
    <exclude name="**/junit.jar" />
    <exclude name="**/*mock.jar" />
    <exclude name="**/strutstestcase*.jar" />
    </fileset>
    </copy>
    <copy todir="${tomcat.home}/webapps/${webapp.name}/WEB-INF/classes" preservelastmodified="true">
    <fileset dir="${build.dir}/classes" />
    </copy>
    </target>


    <target name="compile" description="Compile main source tree java files">
    <mkdir dir="${build.dir}/classes" />
    <javac destdir="${build.dir}/classes" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
    <src path="${src.dir}" />
    <classpath refid="classpath" />
    </javac>

    <mkdir dir="${test.dir}/classes" />
    <javac destdir="${test.dir}/classes" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
    <src path="${test.src}" />
    <classpath>
    <path refid="classpath" />
    <path location="${build.dir}/classes" />
    </classpath>
    </javac>

    <copy todir="${build.dir}/classes">
    <fileset dir="${src.dir}" includes="**/*.hbm.xml" />
    </copy>
    </target>

  2. #2
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    hsql can be configured to run as an inmemory database. Extremely useful for testing

  3. #3
    Join Date
    Jul 2005
    Posts
    4

    Default

    Quote Originally Posted by yatesco
    hsql can be configured to run as an inmemory database. Extremely useful for testing
    Indeed. But I could not find where it is configured.

  4. #4
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    Checkout the hsqldb docs http://hsqldb.sourceforge.net/doc/gu...04.html#N108C6. It is configured in the jdbc url.

    The url would be specified where the datasource is configured, I presume in one of the spring context files.

    I have been known to be completely dense and miss the whole point of the question If I have done, please say, and re-iterate using really small words for me

  5. #5
    Join Date
    Jul 2005
    Posts
    4

    Default

    Quote Originally Posted by yatesco
    Checkout the hsqldb docs http://hsqldb.sourceforge.net/doc/gu...04.html#N108C6. It is configured in the jdbc url.

    The url would be specified where the datasource is configured, I presume in one of the spring context files.

    I have been known to be completely dense and miss the whole point of the question If I have done, please say, and re-iterate using really small words for me

  6. #6
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    confs: can you repost please

  7. #7
    Join Date
    Jul 2005
    Posts
    4

    Default Re: How a hypersonic db is created in Spring Life tutorial?

    Quote Originally Posted by confs
    Hi,

    I have download "Spring Live" sample example in order to learn Spring framework.
    I did not understand and "ant deploy", how a hypersonic data base could be created. But it is the case.

    I checked target "deploy" and "compile", nowhere could I see the creation of database.

    Any explaination?

    Thanks!

    PY


    <target name="deploy" depends="compile" description="Deploy application">
    <copy todir="${tomcat.home}/webapps/${webapp.name}" preservelastmodified="true">
    <fileset dir="${web.dir}">
    <include name="**/*.*" />
    <exclude name="**/junit.jar" />
    <exclude name="**/*mock.jar" />
    <exclude name="**/strutstestcase*.jar" />
    </fileset>
    </copy>
    <copy todir="${tomcat.home}/webapps/${webapp.name}/WEB-INF/classes" preservelastmodified="true">
    <fileset dir="${build.dir}/classes" />
    </copy>
    </target>


    <target name="compile" description="Compile main source tree java files">
    <mkdir dir="${build.dir}/classes" />
    <javac destdir="${build.dir}/classes" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
    <src path="${src.dir}" />
    <classpath refid="classpath" />
    </javac>

    <mkdir dir="${test.dir}/classes" />
    <javac destdir="${test.dir}/classes" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true">
    <src path="${test.src}" />
    <classpath>
    <path refid="classpath" />
    <path location="${build.dir}/classes" />
    </classpath>
    </javac>

    <copy todir="${build.dir}/classes">
    <fileset dir="${src.dir}" includes="**/*.hbm.xml" />
    </copy>
    </target>

    Let me described my "problem" again(it is not really a problem but a miracle that I could not understand").

    I deleted the hypersonic database files in "my tomcat home folder"/bin/db. Then I run again "ant deploy", it appeared again.

    But no where in build.xml traget "deploy" I could see the database definition scripts. How could it be created?

    Thanks again for any new explaination.

    Confs

  8. #8
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    OK, without actually looking I am flying by the seat of my pants

    I expect somewhere in the spring configuration there will be a persistence.xml. In here there will be a datasource configured which will contain a "url" setting. This url setting will probably be something like "jdbc:hsql:." (cannot remember exactly what) which basically tells hypersoniq to create a *new* database everytime an instance of the datasource is created. (Actually, if there are files, the url is most like "jdbc:hsq:mydb.file").

    Hibernate can be configured to create the database during loading (hbm.export or something?), or the unit tests might be writing tear up/down methods which create the database.

    Do a search for "jdbc" in the xml files and read the unit test sources and I am sure that will shine a light

  9. #9
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    BTW; If I am right it will only create the database during unit testing, so deploy probably depends on a unit test ant target.

    Alternatively I might be barking *completely* up the wrong tree and the same actually uses a template database which it simply copies

Similar Threads

  1. Spring + Ibatis tutorial?
    By stevecnz in forum Data
    Replies: 2
    Last Post: Dec 10th, 2007, 11:34 AM
  2. Replies: 0
    Last Post: May 27th, 2005, 09:21 AM
  3. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  4. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  5. Replies: 1
    Last Post: Dec 19th, 2004, 03:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •