0
votes

I have two entities Account and Position. The POSITION table and the ACCOUNT table have contents but the POSITION_ACCOUNT table, which I think should have at least one row, is empty. What could I be doing wrong? Here is the relevant code (I am using EclipseLink 2.4.2:

In Position:

@ManyToMany private List accounts;

In Account:

@ManyToMany(mappedBy = "accounts",fetch=FetchType.EAGER,cascade=CascadeType.PERSIST) @JoinTable(name="POSITION_ACCOUNT")

Confusing to me and perhaps relevant is that some examples I see annotate the getters and setters but others, as I am doing here, annotate the actual Lists.

1
you present no actual persistence code so how can anyone say what you should or shouldn't have? em.persist calls, transaction boundaries etc - user3973283
Thanks, Billy Frost -- I am searching more intelligently based on your comment. - Jeff

1 Answers

0
votes

It turns out that I needed to specify cascade=CascadeType.PERSIST on both sides of the relationship but there were other application-specific issues along the way. I don't know if reading the original question or this answer will be of much help to anyone. Sorry.