Last active
August 29, 2015 14:01
-
-
Save dagvadorj/df74cbd82382a4f9b1b0 to your computer and use it in GitHub Desktop.
Item properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Item implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
private String name; | |
@MapKeyJoinColumn | |
@ManyToMany(cascade = CascadeType.ALL) | |
private Map<ItemProperty, ItemPropertyValues> properties; | |
} | |
@Entity | |
public class ItemProperty implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
private String name; | |
} | |
@Entity | |
public class ItemPropertyValues implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
@ElementCollection(fetch = FetchType.EAGER, targetClass = String.class) | |
private List<String> propertyValues; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment