如何获得“ BaseEntity”参数?

时间:2019-07-24 08:09:13

标签: java spring hibernate

我正在调用由其他人创建的方法,并且有一个参数,但类型为List<BaseEntity>,我不知道该类型是什么,也不知道如何导入该类型参数。

我尝试过这些赚钱的方法,但是失败了。

List<Class> classes = classDao.***; //a method returns List<Class>
List<BaseEntity> tempList = directorDao.findByTargetAndYear(classes, 2019);//Eclipse: not applicable for the arguments

findByTargetAndYear方法

@Query("from Director d where d.target in (:targetList) and d.year = :year and d.subject is null")
    public List<Director> findByTargetAndYear(@Param("targetList") List<BaseEntity> targetList,
            @Param("year") int year);

target property in Director

@Any(metaColumn = @Column(name = "TARGET_TYPE", length = 10), fetch = FetchType.EAGER)
    @AnyMetaDef(idType = "long", metaType = "string", metaValues = {
            @MetaValue(value = "STAGE", targetEntity = Stage.class),
            @MetaValue(value = "GRADE", targetEntity = Grade.class),
            @MetaValue(value = "CLASS", targetEntity = Class.class) })
    @JoinColumn(name = "TARGET_ID")
    @NotNull
    private BaseEntity target;

(Director类已经扩展了BaseEntity类) (数据库中存在STAGE,GRADE和CLASS)

请告诉我如何使用BaseEntity类型作为参数。任何答案将不胜感激!

0 个答案:

没有答案