-->
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: JOIN funktioniert nicht - "unexpected token"
PostPosted: Tue May 31, 2005 5:40 pm 
Beginner
Beginner

Joined: Tue May 31, 2005 5:36 pm
Posts: 21
Folgendes Problem:

Ich würde gerne in meinem Java Code eine Datenbankabfrage mit JOIN über 2 Tabellen durchführen.

Wenn ich folgende Abfrage im HSQL Database Manager mache, funktioniert sie bestens:
Code:
SELECT * FROM kunde k JOIN ticketcard t ON t.kartennr = k.kartennr WHERE t.vname LIKE 'Morgan' AND t.nname LIKE 'Breitfuss' AND k.kartennr = 8;


Versuche ich allerdings, die selbe Anfrage in meinem Javacode zu stellen, bekomme ich untenstehende Unexpected Token Exception. :cry:
Code:
              Session session = HibernateSessionFactory.currentSession();
              //List vlist = session.find("FROM Veranstaltung WHERE Dauer >= 112 ORDER BY Dauer ASC");
                 session.find("SELECT * FROM kunde JOIN ticketcard ON ticketcard.kartennr = kunde.kartennr WHERE ticketcard.vname LIKE 'Morgan' AND ticketcard.nname LIKE 'Breitfuss' AND kunde.kartennr = 8");

Code:
java.lang.RuntimeException: unexpected token: join [SELECT * FROM kunde JOIN ticketcard ON ticketcard.kartennr = kunde.kartennr WHERE ticketcard.vname LIKE 'Morgan' AND ticketcard.nname LIKE 'Breitfuss' AND kunde.kartennr = 8]
    at ticketline.WebAccount$1.widgetSelected(WebAccount.java:153)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2908)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541)
    at ticketline.MainApp1.open(MainApp1.java:736)
    at ticketline.MainApp1.runMain(MainApp1.java:103)
    at ticketline.Login1$2.widgetSelected(Login1.java:139)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2908)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2541)
    at ticketline.Login1.open(Login1.java:216)
    at ticketline.Login1.main(Login1.java:61)

Bitte um rasche Hilfe. Ich habe schon das ganze Internet nach einer Lösung durchsucht, nur gefunden habe ich leider nichts. Das gibt's ja nicht, dass der JOIN im Database Manager funktioniert, aber in meinem Code nicht ... :cry:


---------------------------

Hibernate version: 2


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 10:10 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://www.hibernate.org/hib_docs/api/n ... ang.String)


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.