-->
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.  [ 3 posts ] 
Author Message
 Post subject: Report Query and Custom Type.
PostPosted: Wed May 24, 2006 2:59 pm 
Newbie

Joined: Wed May 24, 2006 2:19 pm
Posts: 1
Location: Sillicon Valley
I am doing reporting for Worflow Requests created in the application. One of the primary tables uses custom type(i.e when the table is loaded into the application by Hibernate it does Ldap lookup for some of the attributes in the table).

This is working fine when I open a given Workflow Request, it does lookup and all the stuff and the functionality offered by Hibernate is cool.

The problem is when I do a report query, and when there is hundreds of request, it takes significant amount of time to load (because it has to perform lookup for each Workflow request).

So, Is there any way that I could tell hibernate not to use custom types for attributes, and to just dump whatever is in the table to my DTO(Data TRansfer Object)

In my case this should just dump the "Username" (String) in table rather than converting it to an "ApplicationUser" (Object) by performing an Ldap Lookup.


I am using Spring 1.2.5 and Hibernate 3.0


Thanks,
- Sathiya


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 3:07 pm 
Regular
Regular

Joined: Mon May 22, 2006 2:30 pm
Posts: 74
There probably isn't enough detailed information here for anyone to respond with detailed advice. At a minimum, you probably want to provide the mapping xml for the persistent objects involved. It may be simply that you need to create another persistent object with a different mapping to the same table, that doesn't use a custom type. Then you work with that persistent object for reports only.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 4:03 pm 
Regular
Regular

Joined: Thu Sep 22, 2005 1:53 pm
Posts: 88
Location: Rio de Janeiro
Hi,

Really you should give a little bit more info to be sure to give
you a correct answer....

But..... I´ll give it a try....
If you use Criteria... than you can use the method setResultTransFormer
and pass a AliasToBeanTransformer...
more or less like this:


Code:
     Criteria s = session.createCriteria
         ..... do what ever is necessary
        .setProjection(Projections.projectionList()
            .add(Projections.property()
               ..... do more stuff if you want
                 )
        )
        .setResultTransformer( new AliasToBeanResultTransformer (<yourdto>.class) )
);



Now your DTO has to have properties with the same name and type as you return
in your Criteria..... and you are on your way... so it is not exactly take it from teh database and throw what ever comes back in my DTO but it comes close ..... I guess

Hope this will help you a bit
Good Luck

_________________
Don´t forget to rate!


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

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.