Every Object has a Category and I'd like to select all categories that appear more than once in the database.
So I created a SQL-Call like this:
Query q = sess.createQuery(
"select ps.category from PersistentSource ps group by ps.category having count(ps.category) > 1"
);
when tyring to do this,hibernate Throws an Excaption:
Code:
11:58:54,981 WARN JDBCExceptionReporter:38 - SQL Error: -28, SQLState: S0022
11:58:54,981 ERROR JDBCExceptionReporter:46 - Column not found: x0_0_
11:58:54,981 WARN JDBCExceptionReporter:38 - SQL Error: -28, SQLState: S0022
11:58:54,981 ERROR JDBCExceptionReporter:46 - Column not found: x0_0_
11:58:54,997 ERROR JDBCExceptionReporter:38 - Could not execute query
java.sql.SQLException: Column not found: x0_0_
at org.hsqldb.jdbcDriver.sqlException(Unknown Source)
at org.hsqldb.jdbcDriver.sqlException(Unknown Source)
at org.hsqldb.jdbcResultSet.findColumn(Unknown Source)
Can anybody give me a tip?
My mapping:
Code:
<class name="de.abelssoft.syncom.model.repositories.PersistentSource" table="PERSISTENTSOURCE">
<id name="id" type="integer" column="ID">
<generator class="native"/>
</id>
<property name="url" column="URL" type="de.abelssoft.hibernate.MyUrlUserType"/>
<property name="className" column="CLASSNAME" type="class"/>
<property name="dateAdded" column="DATEADDED" type="calendar"/>
<property name="lastUpdate" column="LASTUPDATE" type="calendar"/>
<property name="lastChanged" column="LASTCHANGED" type="calendar"/>
<property name="requests" column="REQUESTS" type="int"/>
<property name="category" column="CATEGORY" type="string"/>
<property name="outdatedAt" column="OUTDATEDAT" type="calendar"/>
<property name="originalDataStream" column="ORIGINALDATASTREAM" type="string"/>
<property name="searchtext" column="SEARCHTEXT" type="string"/>
<property name="allObservers" column="ALLOBSERVERS" type="serializable"/>
<property name="type" column="TYPE" type="serializable"/>
<property name="concreteObject" column="CONCRETEOBJECT" type="serializable"/>
</class>
</hibernate-mapping>