Java Reference
In-Depth Information
java -classpath ...
-Dhibernate.connection.driver_class=org.hsqldb.jdbcDriver
-Dhibernate.connection.url= jdbc:hsqldb:file:testdb;shutdown=true
-Dhibernate.connection.username=sa
-Dhibernate.connection.password=
-Dhibernate.connection.pool_size=0
-Dhibernate.show_sql=false
-Dhibernate.dialect=org.hibernate.dialect.HSQLDialect
...
Given its verbosity, this is probably the least convenient of the three methods, but it is
occasionally useful when running tools and utilities on an ad hoc basis. For most other pur-
poses, we think that the XML configuration file is the best choice.
Running the Message Example
With Hibernate and a database installed, and our configuration file created, all we need to do
now is create the classes in full, and then build and run everything. Chapter 1 omitted the triv-
ial parts of the required classes, so we provide them in full in Listings 3-5 through 3-7, after
which we'll look at some of the details of what's being invoked.
Listing 3-5. The Message POJO Class
package sample.entity;
public class Message {
private String message;
public Message(String message) {
this.message = message;
}
Message() {
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
}
Listing 3-6 shows a simple application to populate the messages table with examples.
Search WWH ::




Custom Search