-->
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.  [ 1 post ] 
Author Message
 Post subject: Reasons for FetchMode.JOIN to be ignored?
PostPosted: Tue Feb 15, 2011 5:23 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Hello,

I have a quite common class structure consistsing of the classes Article, SoldArticle, Sell and Bill:

Code:
public class Article {}

public class SoldArticle {
    @ManyToOne(fetch=FetchType.EAGER)
    @Fetch(FetchMode.JOIN)
    @JoinColumn(name = "artikelid", columnDefinition = "INTEGER")
    Artikel artikel;
}

public class Sell {
    @OneToMany(mappedBy = "verkauf", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @Fetch(FetchMode.SUBSELECT)
    private List<SoldArticle> artikel = new ArrayList<SoldArticle>();

    @ManyToOne
    @Fetch(FetchMode.JOIN)
    @JoinColumn(name = "rechnungsid", columnDefinition = "INTEGER")
    private Bill bill;
}


What I would like to do now, is to load all SoldArticles which are assigned to a certain Bill:

list = session.createQuery("FROM SoldArticle va WHERE va.sell.bill.id=xy").list();

Hibernate creates all joins required for the WHERE statement, however it refuses to fetch the artikel-column of the SoldArtikle class.
I also tried to explicitly specify the JOINS in the HQL query, but didn't have a lot success. All I get are javaassist proxy instances :/

Any idea why Hibernate refuses to load SoldArticle.artikel with a JOIN?

Thank you in advance, Clemens


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

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.