Les Cast Codeurs Podcast. Put together Struts2, JPA, Hibernate and Spring | bogdan@j3e. This weekend I played a bit with Struts2. Obviously my first thought was to put together “fellowship of the ring” ie Struts, Spring and Hibernate. Now, we have two ways for integrating Hibernate and I’ve chosen the Java Persistence Architecture approach, because is the latest trend in terms of persistence in the J2EE landscape.
For the sake of simplicity I’ll take a simple example that contains Books and Authors. A book has one or more authors while one author wrote one or more books. This looks like a many to many relationship and we want to be able to get, from one shoot, the book and its authors and for an author his entire list of books. Book.java package org.bserban.shs.model; import javax.persistence import java.util.List; @Entity @Table(name = "book") public class Book { @Id @GeneratedValue private Integer id; private String title; private String publisher; private String keywords; private String ISBN13; private String ISBN10; @ManyToMany(fetch = FetchType.EAGER) private List<Author> authors;
JAGA: Java API for Genetic Algorithms.
Help.