Hibernate Query Problem
voigt_at_ynnor.de
Date: 01/27/05
- Next message: tem2: "Postgres and JDBC?!"
- Previous message: augur: "where and how to set the initial parameter "LARGE_POOL_SIZE""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: tem2: "Postgres and JDBC?!"
- Previous message: augur: "where and how to set the initial parameter "LARGE_POOL_SIZE""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|