Hii all, i try to used fetching strategy in one to many relationship in hibernate, but i little confusing with it.
This my code :
Code:
public List<Album> getAll() {
session = factory.getCurrentSession();
transaction = session.beginTransaction();
List<Album> albums = session.createQuery("from Album a join fetch a.songs s where a.id=s.id ").list();
return albums;
}
In this case i have a Album class and Song class. One album can have many songs or nothing.
But, If the album have not a song, it will not be fetch for me...
Any body help me please....