0

JPA – How to use @Embeddable and @Embedded

In Java Persistence API (JPA), a class can either be an @Entity or a value type. If a class is an @Entity, it is a persistent class. It represents a database table (or set of tables). If a class is a value type, it is not a persistent class. It may not represent a database table or a set of database tables. It may be used as a reusable component whose properties are used across multiple tables. Continue Reading

0

JAXB – Perform Pre- and Post-processing with Unmarshaller.Listener

This post demonstrates how to perform pre- and post-processing with Unmarshaller.Listener. For instance you may want to compare the contents of an object before and after you unmarshal an XML. Another use-case is when you may need to store unmarshalled values to some list not mapped to any XML element. This is achieved by creating a class that extends Unmarshaller.Listener and overriding two (2) methods – beforeUnmarshal and afterUnmarshal. Continue Reading