-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Dynamic Queries
PostPosted: Fri Oct 15, 2010 1:22 pm 
Beginner
Beginner

Joined: Fri Nov 13, 2009 4:05 pm
Posts: 30
We are designing a report framework based on Hibernate. Rather than having to create a new entity object and so on each time a user wants a new report to be added to the system, we'd prefer to have this drive as much by data from the back-end database as possible. My thoughts are that the generic handler accepts a set of parameters that determine which report definition to use and what filters to apply to the query when it gets executed.

So imagine a table named report_definition that defines the table, fields, and potentially layout for each field for a given report. This can easily be modeled as a hibernate entity since its a generic table, and a list of these records returned for a specific report (where each record represents a single field).

Now the report service uses this definition above to create a dynamic SQL statement, passes it to the SQLQuery object and retreives the result. I need to take this result and iterate over it and populate a custom detail bean that is more of a collection of records, each record having a NVP between column/value. This way the detail bean can then be passed to the front-end to be displayed using the same JSP.

Has anyone done anything like this in the past? Can you offer any suggestions on approach or technique to solve this?


Top
 Profile  
 
 Post subject: Re: Hibernate Dynamic Queries
PostPosted: Fri Oct 15, 2010 4:06 pm 
Beginner
Beginner

Joined: Fri Nov 13, 2009 4:05 pm
Posts: 30
Or is it possible to define a single POJO object that will allow me to have a dynamic map of name/value pairs such that the same POJO object can be used to represent TABLE1 with fields A, B, and C and also represent TABLE2 with fields X, and Y?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.