-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Transformers, "select new" HQL, LightWeight Class.
PostPosted: Wed Nov 08, 2006 7:48 pm 
Beginner
Beginner

Joined: Thu May 18, 2006 2:58 pm
Posts: 28
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.