Posts

Showing posts from March, 2012

Smooks Entity Persistence Frameworks - Hibernate

With the new Smooks Persistence cartridge in Smooks 1.2, we can directly use several entity persistence frameworks from within Smooks (Hibernate, JPA etc). So in this blog post let's try out the Hibernate sample specified in here. Since smooks have given the basic configurations only, this blog post is going to assist the peolple who need full implementation.
What we are going to do is process the following XML message and store the product information to a bean and persist the order information.


input.xml
------------

1123456112227 First we have to Specify our Entity classes (Order, OrderLine, Product)
//Order class package example.entity; import java.util.ArrayList; import java.util.List; import javax.persistence.*; @Entity @Table(name="orders") public class Order { @Id private Integer ordernumber; @Basic private String customerId; @OneToMany(mappedBy = "order", cascade = CascadeType.ALL) private List orderItems = new ArrayLi…