换句话说,以下内容:
class Subscriber {
...
static hasMany = [ topics : Topic]
static fetchMode = [topics:"eager"]
static mapping = {
topics joinTable: [name: 'subscriber_topic', column: 'topic_id', key: 'subscriber_id']
}
}
急切地加载join table subscriber_topic,但不加载SQL日志中看到的topic类:
Hibernate:
select
subscriber0_.id as id41_0_,
subscriber0_.version as version41_0_,
....
topics2_.subscriber_id as subscriber1_3_,
topics2_.topic_id as topic2_3_
from
subscriber subscriber0_
left outer join
subscriber_topics topics2_
on subscriber0_.id=topics2_.subscriber_id
where
subscriber0_.id=?
我希望实际获取的主题对象——而不是联接表。但是,似乎提取发生在联接表上,而不是实际关联的对象上。