Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>Query query = session.createQuery("from Pool"); </code></pre> <p>Is an HQL query, it will give you a list of Objects (Pool), so there is no problem to use : </p> <pre><code>&lt;c:forEach items="${pools}" var="pool"&gt; &lt;td&gt;&lt;c:out value="${pool.name}" /&gt;&lt;/td&gt; &lt;/c:forEach&gt; </code></pre> <p>when you use an SQL query, it's different, you will not get a list of objects (you have to add some code and transformations to get a list of pools).</p> <p>Here an example : </p> <pre><code>@SuppressWarnings({ "unchecked", "rawtypes" }) public List&lt;Pool&gt; findPools() { final String query = "select a.id as idAlias, a.name as nameAlias from pool a ...."; List&lt;Pool&gt; list = (List&lt;Pool&gt;) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { SQLQuery sqlQuery = session.createSQLQuery(query); return prepareQueryFind(sqlQuery).list(); } }); return list; } </code></pre> <p>Here i suppose you have a constructor like : </p> <pre><code>public Pool(Integer id, String name); /** Getters and Setters **/ </code></pre> <p>if you are using Hibernate version >= 3.2 </p> <pre><code>@SuppressWarnings("deprecation") private Query prepareQueryFind(SQLQuery query) { return query .addScalar("idAlias", Hibernate.INTEGER) .addScalar("nameAlias", Hibernate.STRING) .setResultTransformer(Transformers.aliasToBean(Pool.class)); } </code></pre> <p>Now you can call fidpools like this :</p> <pre><code>List&lt;Pool&gt; poolList = poolDao.findPools(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload