This part of the article will concentrate on more complex object-relational mappings. Java Persistence has mappings for JDBC BLOBS and CLOBS, serializable objects and embeddable objects. The following will go through each of the mapping one by one.
1. The persistence provider will assume that every nontransient property in your entity bean class is persistent. If you do not want a property to be persistent, you can mark the field or the setter/getter methods with @javax.persistence.Transient annotation depending on the access type.
2. The @javax.persistence.Basic is the most primitive type of O/R mapping that covers all primitives and its wrapper types. The annotation has two interesting attributes: fetch() and optional().
The fetch() attribute defines that strategy for fetching data from the database, which takes two values: EAGER and LAZY. If the FetchType is LAZY, that particular property is not initialized until you actually access the field. The EAGER fetch strategy is the default and it is the opposite of LAZY.