5
は私のように購入の怠惰@ManyToOne
列が定義されて無視さ(= FetchType.LAZYフェッチ)休止@ManyToOne
Purchase purchase = em.find(Purchase.class, id);
PersistenceUnitUtil unitUtil = em
.getEntityManagerFactory()
.getPersistenceUnitUtil();
System.err.println(unitUtil.isLoaded(purchase, "sale"));
フィールドがまだロードされていなくても、これはtrue
を返します。
私は間違っていますか?
(休止4.3.11.Final)
これを防ぐにはどうすればよいですか? –
私が知っているほど多くのオプションはありません。 1つの方法は、「ビルド時のバイトコード計測」です。 http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/performance.html#performance-fetch-lazyproperties – kan
なぜ、この関数は決してうまくいかない場合でもそこにありますか?私は 'nullable = false'を試みても何の効果もありませんでした。 –