132 CHAPTER 6 n MAPPING WITH ANNOTATIONS CHAPTER 6 n MAPPING WITH ANNOTATIONS Listing 6-33. A Sample Excerpt from this Chapter s Task to Perform Schema Generation A full Ant script is provided with the online source code for this chapter (at www.apress.com). Code Listings Listings 6-34 and 6-35 contain the completed annotated source code for the Author and Book classes described in this chapter. The database schema also follows in Listing 6-36. Listing 6-34 illustrates use of the @Entity, @Inheritance, @Id, @GeneratedValue, @Column, @Transient, @ManyToOne, @JoinColumn, and @ManyToMany annotations. Listing 6-34. The Fully Annotated Book Class package com.hibernatebook.annotations; import static javax.persistence.CascadeType.ALL; import static javax.persistence.InheritanceType.JOINED; import java.util.*; import javax.persistence.*; @Entity @Inheritance(strategy = JOINED) public class Book { private String title; private Publisher publisher; private Set authors = new HashSet(); private int pages; private int id; protected Date publicationDate;
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services
This entry was posted
on Wednesday, May 2nd, 2007 at 2:13 pm and is filed under tomcat.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.