Java Reference
In-Depth Information
public void setName(String name) {
this.name = name;
}
public void setBooks(Set<Book> books) {
this.books = books;
}
public void setAddress(AuthorAddress address) {
this.address = address;
}
}
Finally, Listing 6-36 shows the database schema for the classes supporting this chapter,
as generated by the Ant hbm2ddl export task for the HSQL database. You will note that we are
unable to control the names selected for the foreign key relationships. This is one area in
which the Hibernate XML mapping files are superior to the EJB 3 annotations.
Listing 6-36. The Database Schema for the Example
create table Address (
id integer not null,
city varchar(255),
country varchar(255),
primary key (id)
);
create table Author (
id integer generated by default as identity (start with 1),
ADDR varchar(255),
NATION varchar(255),
name varchar(255),
primary key (id)
);
create table Book (
id integer generated by default as identity (start with 1),
pages integer not null,
working_title varchar(200) not null,
publisher_id integer,
primary key (id)
);
create table Book_Author (
books_id integer not null,
authors_id integer not null,
primary key (books_id, authors_id)
);
Search WWH ::




Custom Search