-->
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.  [ 7 posts ] 
Author Message
 Post subject: "Search screen" best practices
PostPosted: Tue Mar 14, 2006 2:11 am 
Newbie

Joined: Thu Feb 23, 2006 1:03 am
Posts: 7
Location: Los Angeles, CA
What is best practices for "Search screens"
I have parent object Blog and childs Post.
On search screen i want to show brief information only Blog.Title and Post.CreatedBy,Post.CreateDate.

1.HQL does not help since it return ArrayList,i need column names and etc
2.Use ICriteria.IList and transform to flat DataTable (think the best choice)
3.Write flat class with mapping (not OOP)

What you guys using??? This was just an example. I need all kind of search
screens specially for Winform. Winform DataGridView not allow bind to child fields (column bind to Bind.Posts.Post)

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 8:41 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
I actually use QBE (query by example) and a generic search form.

Basically, I have a Form whose constructor takes a type. Also, I use custom attributes on my classes to mark the properties that I want to be searchable and listable.

So, to perform searching, all I have to do is create an instance of my SearchBox class, and pass the type of object I want to search for. The SearchBox then builds the text boxes and labels based on my custom attributes and shows itself to the user. When the user clicks the search button, the SearchBox calls my data layer which then calls NHibernate to perform a query by example. The resulting list is then displayed in a DataGridView. The user can then choose from the DataGridView and the chosen object is exposed as a property of the SearchBox back to the calling code.

It wasn't that hard at all, and now whenever I need to prompt the user, I can do it with 3 or 4 lines of code.

--Brian


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 15, 2006 12:43 pm 
Newbie

Joined: Fri Oct 28, 2005 8:23 pm
Posts: 12
Pelton can you explain how you are handling the result set to datagridview process? I always end up flattening the data to do this which sucks.

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 15, 2006 5:27 pm 
Newbie

Joined: Thu Feb 23, 2006 1:03 am
Posts: 7
Location: Los Angeles, CA
Another thing i want to try is create Views and create objects form views only. Do you guys think its good idea???
But then im missing Access database which kind of support Views(called Queries).

Any other ideas???


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 5:14 pm 
Newbie

Joined: Thu Feb 23, 2006 1:03 am
Posts: 7
Location: Los Angeles, CA
Look like nobody use search screens


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 5:27 am 
Newbie

Joined: Mon Feb 20, 2006 6:31 am
Posts: 17
I have an application that fills an ASP.NET 2.0 gridview with data fed by CreateCriteria.List, session.Find or IQuery.List. I must admit that I've not yet tried it with results from different databasetables and joins.

You can easily bind arraylists to a gridview. All you have to do is define the columns and set their datafield to the property name of your transfer objects.
For example:
Code:
<asp:GridView ID="DriverGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="DriverID">
    <Columns>
        <asp:BoundField DataField="LicenseNumber" SortExpression="LicenseNumber" />
    </Columns>
</asp:GridView>

(This is of course a simplified example)

If you use WinForms, it's also very simple. Use a DataGridView to display your results. Also set the AutoGenerateColumns to false and if you use the "edit columns" window, you can set the DataPropertyName to the name of the property you need in that column. You just need to set the DataSource property to the ArrayList returned by the query...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 3:35 pm 
Newbie

Joined: Fri Mar 24, 2006 3:45 pm
Posts: 18
seanmmcc wrote:
Can you explain how you are handling the result set to datagridview process? I always end up flattening the data to do this which sucks.


Sean: You can use objectviews. ObjectViews is like a dataview but for objects and handles inline objects well. Give it a try at http://sourceforge.net/projects/objectviews

Hector Cruz


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