Archive for февруари, 2010

Hibernate – Many-to-many relationship example

“Many-to-many” example This is a many-to-many relationship table design, a STOCK table has more than one CATEGORY, and CATEGORY can belong to more than one STOCK, the relationship is linked with a third table called STOCK_CATEGORY. Hibernate implementation In Hibernate, this “many-to-many” relationship can implemented in two ways : Hibernate XML Mapping file Hibernate Annotation [...]

Cascade – JPA & Hibernate annotation common mistake

Mistake In the one-to-many example, many developers declared the JPA cascade options as following : … @Entity @Table(name = „stock“, catalog = „mkyong“, uniqueConstraints = { @UniqueConstraint(columnNames = „STOCK_NAME“), @UniqueConstraint(columnNames = „STOCK_CODE“) }) public class Stock implements java.io.Serializable { … private Set<StockDailyRecord> stockDailyRecords = new HashSet<StockDailyRecord>(0); @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST,CascadeType.MERGE }, mappedBy = [...]

Задвижван с помощта на WordPress | Compare Cell Phone Plans at iCellPhonePlans.com | Thanks to Cheap Palm Pixi, Bromoney and Wordpress Themes