hibernate onetomany onetoone filter

时间:2013-03-15 07:44:32

标签: hibernate filter one-to-many one-to-one

我有三个实体批次流程文档流程

@ManyToOne(cascade = ALL, optional = false)
private MaterialDocument document;

有:

@Basic(optional = false)
@Enumerated(EnumType.STRING)
private Type type;

public static enum Type {IN, OUT}

每个批次必须包含:

@OneToOne(optional = false)
private MaterialFlow flowIn;

流程,其中 document.type = Document.Type.IN

@OneToMany(mappedBy = "batch", orphanRemoval = true, fetch = LAZY)
private List<MaterialFlow> flowsOut;

流程,其中 document.type = Document.Type.OUT

我需要用什么@Filter注释来实现这一点?或者也许有更好的方法?

0 个答案:

没有答案