the AuctionItem's dependent object AuctionInfo is being use by one of the HQL query statement. And this is why, at runtime, hibernate need to see this class for the return values of the executed query. Here is the snipet of the codes in the example 'eg' that comes with the Hibernate distribution.
List auctions = s.createQuery(
"select new AuctionInfo( item.id, item.description, item.ends, max(bid.amount) ) "
+ "from AuctionItem item "
+ "left join item.bids bid "
+ "group by item.id, item.description, item.ends "
+ "order by item.ends desc"
)
.setMaxResults(100)
.list();
the xml:
<hibernate-mapping
package="org.hibernate.auction">
<import class="AuctionInfo"/>
<class name="AuctionItem">
<id name="id">
<generator class="native"/>
</id>
<property name="description"/>
<property name="ends"/>
<property name="condition"/>
<many-to-one name="seller" not-null="true"/>
<many-to-one name="successfulBid" outer-join="false"/>
<bag name="bids" lazy="true" inverse="true" cascade="all">
<key column="item"/>
<one-to-many class="Bid"/>
</bag>
</class>
</hibernate-mapping>
and I need to generate this exact mapping using xdoclet extenstion for hibernate.
Thanks,
--danny
|