Skip to content

Instantly share code, notes, and snippets.

@bmchild
Created May 29, 2014 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmchild/f2a924185ade51027440 to your computer and use it in GitHub Desktop.
Save bmchild/f2a924185ade51027440 to your computer and use it in GitHub Desktop.
public class ParentEntity implements Serializable {
@Id
private Long Id;
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "COLLECTION_TABLE_NAME",
joinColumns = @JoinColumn(name = "PARENT_ENTITY_COLUMN", referencedColumnName = "COLLECTION_COLUMN"))
@OrderBy("collectionProperty")
private List<CollectionObject> myCollection;
.
.
.
}
@Embeddable
@SuppressWarnings("serial")
public class CollectionObject implements Serializable {
@Column(name = "COLLECTION_COLUMN")
private Integer collectionProperty;
@Column(name = "OTHER_FIELD")
private String collectionField;
.
.
.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment