Hibernate Query Problem

voigt_at_ynnor.de
Date: 01/27/05


Date: 27 Jan 2005 07:04:15 -0800

Hello!

Having problems with my hibernate query...
I've got the following mapping:

Class Schiff:

<hibernate-mapping auto-import="true" default-access="property"
default-cascade="none">
<class name="sps.data.Schiff" table="SCHIFF" batch-size="1"
mutable="true" dynamic-update="false" polymorphism="implicit"
optimistic-lock="version" dynamic-insert="false"
select-before-update="false">
<id name="id" column="`schiff_id`" type="int"
unsaved-value="null">
<generator class="assigned"/>
</id>
.
.
.

<!-- RELATIONS -->
<set name="makler" table="`schiff_makler`" lazy="true">
<key column="`schiff_id`" />
<many-to-many column="`makler_id`" class="sps.data.Makler" />
</set>
</class>
</hibernate-mapping>

And class Makler:

<hibernate-mapping auto-import="true" default-access="property"
default-cascade="none">
<class name="sps.data.Makler" table="MAKLER" batch-size="1"
mutable="true" dynamic-update="false"
polymorphism="implicit" optimistic-lock="version"
dynamic-insert="false"
select-before-update="false">

<id name="id" column="`makler_id`" type="int"
unsaved-value="null">
<generator class="assigned"/>
</id>
.
.
.
<set name="schiffe" table="`schiff_makler`" lazy="true">
<key column="`makler_id`" />
<many-to-many column="`schiff_id`"
class="sps.data.Schiff" />
</set>
</class>
</hibernate-mapping>

So as you can see there is an m:n relation between Schiff and Makler.
Now I'd like to get all Schiff objects that are related to one makler,
sorted by the ship's name (that's why I can't simply call
makler.getSchiffe()). I have tried the following:

Query q = hibernateSes.createQuery(
"select s from Schiff as s where :makler in elements(s.makler) "+
"order by s.name"
);
q.setEntity("makler", makler);
List l = q.list();

Using firebird database 1.5 I get the following error "datatype
unknown":

Could not execute query
net.sf.hibernate.exception.GenericJDBCException: Could not execute
query
at
net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:81)
.
.
.
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception.
335544569. Dynamic SQL Error
SQL error code = -804
Data type unknown
at
org.firebirdsql.jdbc.AbstractPreparedStatement.(AbstractPreparedStatement.java:88)
at
org.firebirdsql.jdbc.FBPreparedStatement.(FBPreparedStatement.java:34)
at
org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:701)
at
.
.
.

I would be very glad if anyone can help...
Thanks!

Bastian Voigt



Relevant Pages

  • Re: Re: Sorting Problem
    ... Subject: Sorting Problem ... SQL Error ... The UNIQUE or DISTINCT operator is used. ... The query selects into a temporary table (SELECT ... ...
    (comp.databases.informix)
  • UBB Thread printthread.php SQL Injection
    ... The main query parameter is used twice in this page, in different queries and in different number of columbs ... second query to be invalid, and because of that, any output that was is dismissed and an error message only for the second query is shown ... If no results are returned from the first query the second query is not processed, thus, no SQL error will output ...
    (Bugtraq)
  • Re: VBA that opens parameter query in excel spreadsheet
    ... excel. ... I use the MyRecordset.Open command and this works for a select query, ... however I would also like to call a function that opens a parameter query ... When I attempt to call the function I get an SQL error. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Sorting Problem
    ... SQL Error ... context. ... The UNIQUE or DISTINCT operator is used. ... The query selects into a temporary table (SELECT ... ...
    (comp.databases.informix)
  • Re: Sorting Problem
    ... SQL Error ... context. ... The UNIQUE or DISTINCT operator is used. ... The query selects into a temporary table (SELECT ... ...
    (comp.databases.informix)