ModPmクラスを取得しました
@Entity
@Table(name="MOD_PM")
public class ModPm extends WebPageObject implements Serializable, IDBNamedEntity {
private static final long serialVersionUID = 1L;
public final static String Q_GET_DEPENDENT_LIST_FOR_NEW_SCOPE = "ModPm.getDependentForNewScope";
public final static String Q_GET_DEPENDENT_LIST_WITHOUT_STATUS_FOR_SCOPE = "ModPm.getDependentWithoutStatusForScope";
public final static String Q_GET_STATUS_FOR_NEW_SCOPE = "ModPm.getStatusForNewScope";
public final static String Q_GET_WITHOUT_STATUS_FOR_SCOPE = "ModPm.getWithoutStatusForScope";
@Id
@SequenceGenerator(name="MOD_PM_ID_GENERATOR", sequenceName="MOD_PM_SEQ", allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MOD_PM_ID_GENERATOR")
@Column(name="ID")
private long id;
@Column(name="COMMIT_NUMBER")
private int commitNumber;
@Lob()
@Basic(fetch=FetchType.LAZY)
@Column(name="LIST_ARCHIVE")
private byte[] listArchive;
....
@Lob
@Basic(fetch=FetchType.LAZY)
@Column(name="TEXT_MASTER")
private String textMaster;
....
@ManyToMany
@JoinTable(
name="MOD_PM_DEPENDENCE"
, joinColumns={
@JoinColumn(name="PRIMARY_PM_ID")
}
, inverseJoinColumns={
@JoinColumn(name="DEPENDENT_PM_ID")
}
)
private List<ModPm> modPms2;
および NamedQuery
@NamedQueries({
@NamedQuery(name = ModPm.Q_GET_DEPENDENT_LIST_FOR_NEW_SCOPE,
query = "SELECT DISTINCT p FROM ModPm p " +
"WHERE p.modSystem.id=(SELECT s.modSystem.id FROM ModScopeType s WHERE s.id=?1) " +
"AND p.test=false AND p.rejected=false " +
"AND p.modPms2 IS NOT EMPTY"),
...
}
クエリを実行しようとすると、休止状態ですべてのデータベースを再帰的にロードします。ModPm クラスからの startinf (すべての BLOB とコレクションを含む)。
私のpersistence.xmlファイル:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="mod-db-jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/security</jta-data-source>
....
<class>com.ecleasing.db.jpa.entity.ModPm</class>
....
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<validation-mode>CALLBACK</validation-mode>
<properties>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.CMTTransactionFactory" />
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform" />
<property name="hibernate.dialect" value="com.ecleasing.db.hibernate.dialect.Oracle10gExtendedDialect" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory" />
<property name="hibernate.cache.use_second_level_cache" value="true" />
<property name="hibernate.cache.use_query_cache" value="false" />
<property name="hibernate.max_fetch_depth" value="0" />
</properties>
</persistence-unit>
</persistence>
また、各コレクションに「fetch=FetchType.LAZY」で注釈を書き込もうとしましたが、役に立ちませんでした。