Skip to content

Instantly share code, notes, and snippets.

@stephanie-gredell
Last active August 29, 2015 14:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephanie-gredell/9c7f7458387f9310b7bd to your computer and use it in GitHub Desktop.
Save stephanie-gredell/9c7f7458387f9310b7bd to your computer and use it in GitHub Desktop.
Create a ManyToMany relationship in EBean
public class EntityList extends Model {
@Id
private Integer id;
@Constraints.Required
public String title;
@Constraints.Required
public String type;
@ManyToMany
@JoinTable(name="list_entities", joinColumns = @JoinColumn(name="list_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name="block_id", referencedColumnName = "id"))
public List<Asset> assets;
public static Model.Finder<Integer,EntityList> find = new Finder<Integer,EntityList> (
Integer.class, EntityList.class
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment