SOLVED
Code
Session session = HibernateSessionFactory.currentSession();
List l = session.find("from Ticketcard as t, Kunde as k where t.kartennr = k.kartennr AND t.vname LIKE 'Morgan' AND t.nname LIKE 'Breitfuss' AND k.kartennr = 8"); // direkte Datenbankquery
System.out.println("DEBUG: Liste l Größe: " + l.size());
for (ListIterator iter = l.listIterator(); iter.hasNext();) {
Ticketcard t = (Ticketcard)iter.next();
System.out.println(t.getVname() + t.getNname() + t.getKartennr());
}
Code
java.lang.ClassCastException: [Ljava.lang.Object;
at ticketline.WebAccount$1.widgetSelected(WebAccount.java:168)
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)
Alles anzeigen
Meine Frage ist: Wieso? Ich habe einen ganz ähnlichen Code an einer anderen Stelle im Programm, der tadellos funktioniert ...
Btw: Wisst ihr vielleicht andere Möglichkeiten um Vorname, Nachname und Kartennummer aus der Datenbank bzw. der Liste auszulesen?