エンティティ例の DAO で FetchProfile を使用したいと考えています。
これは私のエンティティの注釈です:
@FetchProfiles({ @FetchProfile(name = "example-profile", fetchOverrides = {
@FetchProfile.FetchOverride(entity = Example.class, association = "association1", mode = FetchMode.JOIN),
@FetchProfile.FetchOverride(entity = Example.class, association = "association2", mode = FetchMode.JOIN) })
})
これは私のDAOです:
@Autowired
private SessionFactory sessionFactory;
public Example getExample(Long id) {
sessionFactory.getCurrentSession().enableFetchProfile("example-profile");
return (Example) sessionFactory.getCurrentSession().get(Example.class, id);
}
getExample を呼び出すと、次の例外が発生しました。
org.hibernate.UnknownProfileException: 不明なフェッチ プロファイル [example-profile]
マッピングか何かがありませんか?