In this article I want to explain an issue concerning the JPA OneToMany relationship which I was faced with in one of my own projects. Working with object -orientated languages like java we often model relationships between object in various cases. One of such relationships is the OnToMany relationship. For example an object ‘Server’ may have a relationship to an object ‘Configuration’. To make the ‘Configuration’ object generic we can model the JPA object in Java like this:
@javax.persistence.Entity public class Configuration implements java.io.Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private BigInteger id; public String itemValue; public String itemName; @SuppressWarnings("unused") private Configuration() { } public Configuration(String name, String value) { itemValue = value; itemName = name; } }