-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: SQL Named Query & Parameter
PostPosted: Fri Jul 14, 2006 1:08 am 
Newbie

Joined: Fri Jul 14, 2006 1:01 am
Posts: 1
Hallo,

wir versuchen gerade in einer alten Anwendung JDBC-DAOs auf Hibernate umzustellen. Hierzu möchten wir das DB-Schema erhalten und deshalb auch die alten SQL Abfragen. Leider haben wir da ein kleines Problem.

Anbei schicke ich die beiden Mappings mit den Named queries. Wie bekomme ich nun in der Query "get_workweek" den parameter :workweekid auf den Werk workweekid aus der Abfrage in Machine gesetzt?

Grüße
---
Joachim

Code:
<hibernate-mapping package="com.lessmann.capa.model.impl">
 
  <class name="MachineImpl" table="machines">
     <id name="id" column="Id"></id>
     
     <property name="MachineSearchString" type="string" column="MachineSearchString"/>
     <property name="TaskSearchString" type="string" column="TaskSearchString"/>
     <property name="Multiplicity" type="integer" column="Multiplicity"/>
     
   <one-to-one name="WorkWeek" class="WorkWeekImpl" foreign-key="workweekid"></one-to-one>

     <loader query-ref="get_machines"/>
  </class>
 
  <sql-query name="get_machines">
     <return alias="machines" class="MachineImpl"/>
     SELECT * FROM machines
  </sql-query>
</hibernate-mapping>


<hibernate-mapping package="com.lessmann.capa.model.impl">
<class name="WorkWeekImpl">
<id name="id" column="id">
</id>

<loader query-ref="get_workweek"/>
</class>

<sql-query name="get_workweek">
<return alias="workweek" class="WorkWeekImpl"/>
SELECT * FROM workweek WHERE id = :workweekid
</sql-query>
</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.