Ok, I have an object that (simplified to the parts I care about) looks like this:
Code:
@Entity
@Table(name = "MasterEnum")
public class MasterEnumRecord
{
@Id
@Column(name = "EnumId")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@CollectionOfElements(fetch = FetchType.EAGER)
@JoinTable(name = "MasterEnumFamIdMfgIds", joinColumns = @JoinColumn(name = "EnumId"))
private Set<FamIdMfgIdEntry> famIdMfgIdEntries;
}
The class FamIdMfgIdEntry is as follows:
Code:
@Embeddable
public class FamIdMfgIdEntry
{
@Column(name = "FamId")
private Integer famId;
@Column(name = "MfgId")
private Integer mfgId;
}
Each class of course has its necessary getters, setters, etc, but this gives you the idea of what the classes look like.
So what I need to do, ideally, would be to run a query more or less as follows: (these are pseudo queries, they don't work)
delete from FamIdMfgIdEntry f where f.famId = X.
Failing that, I need to be able to
select from MasterEnumRecord m where m.famIdMfgIdEntries contains a FamIdMfgIdEntry with famId = X.
Currently I'm iterating over all of my MasterEnumRecords and clearing the entries which contain X for FamId, but while that works, it's not elegant, and it takes way longer than this simple task should. Any help would be
GREATLY appreciated