Created
May 29, 2014 19:35
-
-
Save bmchild/f2a924185ade51027440 to your computer and use it in GitHub Desktop.
This file contains 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
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