Java Magazine, May/June 2018
ORACLE COM JAVAMAGAZINE MAY JUNE 2018 51 design patterns Lets take an example of an instrument craft shop A crafted instrument is an identifiable entity implemented as a plain Java class In Java EE its especially interesting to see how the entities are persisted to the database via Java Persistence API JPA The examples Ill use are from a music instrument craft shop application In the following code the JPA annotation @ Entity is used to map identifiable domain entities to the database JPA requires that the entity define an identifier mapped by @ Id @ Entity public class ElectricGuitar @ Id private long id private Model model public long getId return id public void setId long id this id id public Model getModel return model public void setModel Model model this model model
You must have JavaScript enabled to view digital editions.