SQLQuery.addEntity(Class entityClass).list()

http://docs.jboss.org/hibernate/core/3.3/api/org/hibernate/class-use/SQLQuery.html

-----Original Message-----
From: Henrique Boregio [mailto:hbore...@gmail.com] 
Sent: Friday, December 10, 2010 3:40 AM
To: users@wicket.apache.org
Subject: SQL Query casting objects

I have an SQL query to do a full-text search on my database:

String sql = "SELECT * FROM Items WHERE MATCH (title, description) AGAINST ('" 
+ searchText + "');"; List items = session.createSQLQuery(sql).list();

When I execute it, it returns a list with the rows it found as a result.
Each row is actually an "Item" object, but since this is an SQL query, the 
result is an array of Objects.
Is there a way to cast it to an "Item" object without having to manually go 
through each of the columns it returns?

The same way an HQL automatically casts the results:
List<Item> items = (List<Item>) session.createQuery( ... );

I had no luck finding out how to implement sql MATCH and AGAINST using HQL.

Does anyone know a solution to this issue? Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to