-->
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.  [ 2 posts ] 
Author Message
 Post subject: probleme mit join
PostPosted: Thu Mar 01, 2007 6:36 am 
Newbie

Joined: Wed Jun 21, 2006 9:48 am
Posts: 12
Location: Germering
Wenn ich den join so anwende, nimmt er immer den PK von tbl_detail nicht ber den wert vom Attribut product.

Übrigens auch, wenn ich statt foreign-key property-ref nutze.

Wo liegt der Denkfehler?


Hibernate version: 3.1.3

Mapping documents:
Code:
detail.hbm.xml
=============
<class name="Detail" table="tbl_detail">
   <id ...>
   </id>

   ...

   <join table="tbl_product">
      <key column="product_id" foreign_key="product">
      <property name="product" column="product_name" />
   </join>
   
</class>


Name and version of the database you are using: postgre 8.1.3

Java Class
Code:
public class Detail {

   private String product; // name des Produkts wird benötigt

   ...

   public String getProduct () {..}
   public void setProduct () {...}

   ...

}


tables
Quote:
tbl_product
==========
product_id
product_name
product_netto
product_vat



tbl_detail
========
detail_id
product <-- FK zur product_id in tbl_ product
...


Danke
weissnix


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 3:44 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
key column ist bei Dir produkt (Tabellespalte für den FK). Property Ref brauchst Du nur, wenn sich produkt nicht auf den Primary key der Produkttabelle bezieht.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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

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.