Godsmack wrote:
hi,
by these select I have selected a list of net.sf.hibernate.type.Type object:
List typeList = session.find("SELECT B.id, B.name " +
"FROM Brand B, RelBrand RB WHERE RB.study = ?" +
"AND B.id = RB.brand.id", new Object[] { idStudy },
new Type[] { Hibernate.LONG, Hibernate.STRING });
How can I get java.lang.Long and java.lang.String from net.sf.hibernate.type.Type[] array, without mapping to object ??
Note that the role of the type array is not to specify the types of the params you receive in return, but the ones you are setting as parameters in the query!!
Quote:
/**
* Execute a query with bind parameters.
*
* Binding an array of values to "?" parameters in the query string.
*
* @param query the query string
* @param values an array of values to be bound to the "?" placeholders (JDBC IN parameters).
* @param types an array of Hibernate types of the values
* @see Hibernate for access to <tt>Type</tt> instances
* @return a distinct list of instances
* @throws HibernateException
*/
So if you are casting the result to Type[] objects it will probably give you a classcastexception. I don't remember what type you should be receiving as list elements, though, maybe Object[]?