我使用reflection重新审阅了Java Bean Properties。但是我无法从Orignal Bean获取集合,自定义对象。例如,
@Entity
@Table(name = "ucms_user_tbl")
public class Employee {
@Id
@Column(name="employee_no")
private int employeeno;
@Column(name="Employee_name")
private String employeeName,
//one-to-Many
@OneToMany(mappedBy="EmpDtl")
private List<EmpDtl> dtlList=new ArrayList<EmpDtl>();
@ManyToOne
@JoinColumn(name="status_id")
//Many-to-One
private EMPStatus empStatus;
}
我使用反射重新检查了雇员,但是我无法找到dtlList,empStatus属性。
for(Method metd:method){
Annotation[] annotations = m.getAnnotations();
for(Annotation annotation : annotations){
if(annotation instanceof Column){
Column myAnnotation = (Column) annotation;
name=myAnnotation.name();
}
}
}