Hibernate version:
hibernate-3.2.5
Mapping documents:
<hibernate-mapping>
<class name="de.laliluna.example.Honey" table="honey">
<id name="id" column="id" type="long">
<generator class="increment"/>
</id>
<property name="name" column="name" type="java.lang.String" />
<property name="taste" column="taste" type="java.lang.String" />
</class>
</hibernate-mapping>
taken from
http://www.roseindia.net/hibernate/index.shtml
Code between sessionFactory.openSession() and session.close():
private int selectHoney(String query, String comment, boolean order)
{
Transaction dutTx = null;
InitSessionFactory dutInit = new InitSessionFactory();
Session dutSession = dutInit.getDutInstance().getCurrentSession();
List dutRecords = null;
try
{
dutTx = dutSession.beginTransaction();
dutRecords
= dutSession.createQuery(query).list();
dutTx.commit();
dutInit.closeDut();
Full stack trace of any exception that occurs:
Name and version of the database you are using:
mysql 5.0.45 with JDBC 3.1.14
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hi,
I am wondering if I doing this wrong, but I am wondering why createQuery(someHQLQuery).list() returns an Object[] and not a Object? This will really make my java reflections code messier. Is there another solution? I rather have HQL return a Honey Object, so I can get information from all the columns. Currently, the Object[] does not include the auto_increment 'id' column. Thank you for any help you can provide.
Thanx,
brad