CHAPTER 6 n MAPPING WITH ANNOTATIONS 135 n MAPPING WITH ANNOTATIONS 135 private int id; private String name; private Set books = new HashSet(); private AuthorAddress address; // Constructors… protected Author() { } public Author(String name, AuthorAddress address) { this.name = name; this.address = address; } // Getters… @Id @GeneratedValue public int getId() { return id; } public String getName() { return name; } @ManyToMany(mappedBy = “authors”) public Set getBooks() { return books; } @Embedded @AttributeOverrides({ @AttributeOverride(name=”address”,column=@Column(name=”ADDR”)), @AttributeOverride(name=”country”,column=@Column(name=”NATION”)) }) public AuthorAddress getAddress() { return this.address; } // Setters… public void setId(int id) { this.id = id; }
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision mysql5 web hosting services
This entry was posted
on Thursday, May 3rd, 2007 at 11:05 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.