Skip to content

Instantly share code, notes, and snippets.

@sebersole
Last active December 16, 2015 06:29
Show Gist options
  • Save sebersole/5391925 to your computer and use it in GitHub Desktop.
Save sebersole/5391925 to your computer and use it in GitHub Desktop.
@Entity
@Table(name = "ACTIVITY")
@Audited
public class Activity implements Serializable {
@Id
@Column(name = "Id")
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@ManyToOne
@JoinTable(
name="ACTIVITYPROFILE_ACTIVITY",
joinColumns = @JoinColumn(name="ACTIVITY_ID", referencedColumnName="ID"),
inverseJoinColumns = @JoinColumn(name="ACTIVITYPROFILE_ID", referencedColumnName="ID")
)
private ActivityProfile activityProfile;
...
}
@Entity
@Table(name = "ACTIVITYPROFILE")
public class ActivityProfile {
@Id
@Column(name = "ActivityProfileId")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToMany(mappedBy="activityProfile", cascade = { CascadeType.ALL })
private List<Activity> activities;
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment