Trying to develop the best way to implement the following...
I have Clob column in a database table that I am using for a keyword search. I don't need this column instantiated in the POJO and returned the the UI, only for the search.
I got around this for the search by using dynamic instatiation with a
select new <className>(....) http://forum.hibernate.org/viewtopic.php?t=963141&highlight=.
But now (later in development!), I have a many-to-one association to that table and when I initilize the property using a fetch, it uses the mapping-file and instatiates the Clob column.
The lightweight class
http://www.hibernate.org/41.html can be used for this and will work well since I'm not searching on the Clob but joining with a foreign key.
I also saw some postings on Transformers
http://blog.hibernate.org/cgi-bin/blosxom.cgi/2006/03/17/ but don't know if I can implement this here.
Updated
Trying
Named SQL Queries as I write this.
http://www.hibernate.org/hib_docs/v3/reference/en/html/querysql.html#querysql-namedqueries. This method requires all the mapped columns to be returned. Since I don't want the clob column returned anywhere, just want it to be queried...
THIS METHOD WORKS AND IS THE EASIEST TO USE. I return a list of the pojo and it's quite simple...see the code.
Code:
<sql-query name="quickExplore">
<return alias="product" class="com.prod.model.Product"/>
<![CDATA[select
PROD_ID {product.prodId},
TYPE {product.type},
TERRITORY_EXCLUSIVE {product.territoryExclusive},
CATEGORY {product.category},
ASSET_TYPE {product.assetType},
RANK {product.rank},
UPDATE_DATE {product.updateDate},
UPDATE_USER {product.updateUser},
CREATE_DATE {product.createDate},
CREATED_BY {product.createdBy}
from IRMAIR.E_PRODUCT_DATA
where contains(KEYWORD_SEARCH, :searchArg, 1) > 1]]>
</sql-query>
What about Mapping a class more than once
http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-entityname
Any thoughts for a best case to handle this.
Thanx.