O'Reilly logo

Harnessing Hibernate by James Elliott, Ryan Fowler, Timothy M. O'Brien

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Trying It Out

Once this is all set, you can rerun the schema-creation example that was set up in “Cooking Up a Schema” way back in Chapter 2. This time it will build the schema on your MySQL server rather than in the embedded HSQLDB world. You’ll see output like what’s shown in Example 10-4, although it will be longer than the example, in which we’ve cut out some of the repetitive and boring output, and highlighted a few particularly salient bits that prove our new settings have taken effect. (Note that we’re starting with a separate ant prepare invocation, since this is the first time we’re working in this chapter’s example directory, and we need the right files in the class path before Ant first starts up to run the schema target.)

Example 10-4. Schema creation when connecting to MySQL

% ant prepare
Buildfile: build.xml
Downloading: mysql/mysql-connector-java/5.0.5/mysql-connector-java-5.0.5.pom
Transferring 1K
Downloading: mysql/mysql-connector-java/5.0.5/mysql-connector-java-5.0.5.jar
Transferring 500K

prepare:
    [mkdir] Created dir: /Users/jim/svn/oreilly/hibernate/current/examples/ch10/
classes
     [copy] Copying 5 files to /Users/jim/svn/oreilly/hibernate/current/examples
/ch10/classes

BUILD SUCCESSFUL
Total time: 3 seconds

% ant schema Buildfile: build.xml prepare: usertypes: [javac] Compiling 2 source files to /Users/jim/svn/oreilly/hibernate/current /examples/ch10/classes codegen: [hibernatetool] Executing Hibernate Tool with a Standard Configuration [hibernatetool] 1. task: hbm2java ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required