Optimizing dynamic SQL query

I'm looking for a SQL query builder that can optimize SQL queries based on a set of data that I want to retrieve from the database. The set of data is an array of "give me the value of column A from table B where the column C equals D". The value of A, B, C and D can be arbitrary in the array, but many records will share the same B, C and D.

What would be the best way to concatenate a query for Hibernate? Is there any reason to use another framework for queries like this?

Answers


Criteria is for you:

http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querycriteria.html

List cats = sess.createCriteria(Cat.class)
    .add( Restrictions.like("name", "Fritz%") )
    .add( Restrictions.or(
        Restrictions.eq( "age", new Integer(0) ),
        Restrictions.isNull("age")
    ) )
    .list();

Need Your Help

how to let the parser print help message rather than error and exit

python argparse

I am using argparse to handle cmd args, I wanna if there is no args specified, then print the help message, but now the parse will output a error, and then exit.

How to deal with duplicate code under Linux?

php linux copy-paste code-duplication

I'm looking for the best approach to dealing with duplicate code in a legacy PHP project with about 150k lines of code.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.