0

我使用反射检索了 Java Bean 属性。但我无法从原始 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;


}

我使用反射检索了employeeno,employeename。但我无法找出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();

                   }
         }
}
4

0 回答 0