-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello
i got an issue with data and listbox, I’m trying put data from three joined tables to listbox and it doesn’t work, the problem is probably in hibernate but I can’t resolve it.
Tables:
actor(actor_id, first_name, last_name)
film_actor (actor_id, film_id)
film(film_id, title)
these tables are correctly maped because it works fine with each table separate but I want to get list() like this: list<ActorFilm> where ActorFilm is class defined below:
public class ActorFilm implements java.io.Serializable {
private String firstName;
private String lastName;
private String title;
public ActorFilm () {
}
public ActorFilm (String firstName, String lastName, String title) {
this.firstName = firstName;
this.lastName = lastName;
this.title = title;
}
Get()…..
Set()…..
}
I’ve tried use code:
String sql= "SELECT actor.first_name, actor.last_name, film.title FROM (sakila.film_actor film_actor JOIN sakila.film film ON (film_actor.film_id = film.film_id)) JOIN sakila.actor actor ON (film_actor.actor_id = actor.actor_id) WHERE (actor.first_name = 'PENELOPE')";
List< ActorFilm > actfilms=currentSession.createSQLQuery(sql).list();
And it doesn’t work
Asked: 2012-02-15 20:33:10 +0800
Seen: 180 times
Last updated: Feb 16 '12