querying

NHibernate, Sum Query

If i have a simple named query defined, the preforms a count function, on one column: <query name="Activity.GetAllMiles"> <![CDATA[ select sum(Distance) from Activity ]]> </query> How do I get the result of a sum or any query that dont return of one the mapped entities, with NHibernate using Either IQuery or ICriter...

Eager loading child collection with NHibernate

I want to load root entities and eager load all it's child collection and aggregate members. Have been trying to use the SetFetchMode in FluentNHibernate, but are getting duplicates in one of the child collection since I have a depth of 3 levels. DistinctRootEntityResultTransformer unfortunately only removes the root duplications. ret...

Problems with repository pattern reuse and query support

Guys, I've been reading both ddd and PoEAA books, and searching a lot on the web but i'm still confused and i think there is something i'm missing about the repository pattern: Context of use: Web apps (monorail + activerecord) What i'm looking for: reuse a 'base' repository among project. The repository will be the typical IReposit...

Grails Many to Many Association Querying

I have a many to many relationship. class Post { String title static hasMany = [tags:Tag] } class Tag { static hasMany = [posts:Post] } I would like to get a list of posts for a tag that have some other criteria (like a sort order, partial title match, etc). Do I have to use the grails criteria to achieve this? Or is ther...

Looking for a script/tool to dump a list of installed features and programs on Windows Server 2008 R2.

Hi, The same compiled .Net / C++ / Com program does different things on two seemingly same computers. Both have DOZENS of things installed on them. I would like to figure out what the difference between the two is by looking at an ASCII diff. Before that I need to "serialize" the list of installed things in a plain readable format - sor...

Effective way of doing http queries to a server on Java

I'm working on a software that does extensive queries to a database which is has a http interface. So my program parses and handles queries that are in form of long http:// addresses.. I have realized that the bottleneck of this whole system is the querying and the data transfer barely goes above 20KB/s even though I am sitting in the ...

Querying a polymorphic association

I have a polymorphic association like this - class Image < ActiveRecord::Base has_one :approval, :as => :approvable end class Page < ActiveRecord::Base has_one :approval, :as => :approvable end class Site < ActiveRecord::Base has_one :approval, :as => :approvable end class Approval < ActiveRecord::Base belongs_to :approvable...

Subquery or a double query?

Hi all, For a client I have built a travelagency website. Now they asked me to optimize and automize some things. One of these things is that the accommodations shown in the searchlist must be bookable. Simplified this is the structure I have an AccommodationObject, an Accommodation has 1 or more PricePeriods. What I need to do pick ...

Should I create multiple services (using the Spring `@Service` stereotype) to do database lookups for different controllers?

I'm not sure where to do database lookups for Spring controllers. It seems to make sense to use the Spring @Service stereotype and create multiple "services" to provide lookup support to controllers rather than doing lookups directly in the controllers. Is this correct or is there a more appropriate place to perform database lookups? ...