开发者

lazy fetching problem

I have a problem with lazy fetching. here's what I have. I have a entity class called channel. and another entity class called show. Each channel has many show's. I've implemented hibernate with lazy fetching.But heres the problem, when I get a channel from database and after that try to access the programm list I get a nullpointerException. Here's some code:

 telekanalService.findAllTelekanal(new AsyncCallback<List<Telekanal>>() {
          public void onFailure(Throwable caught) {
            // Show the RPC error message to the user
           errorLabel.setText(caught.getMessage());

          }

      public void onSuccess(List<Telekanal> result) {
       //Programm tel = result.get(1);
       List<Programm> prog = result.get(0开发者_StackOverflow社区).getProgrammid(); //problem with this
       //Telekanal tell = tel.getTelekanal();
       errorLabel.setText("tehtud:" + prog.size()); //returns Nullpointerexception
      }
});

Maybe I have some mapping errors, here are my mapping files Programm.hbm.xml:http://pastebin.com/Q639HreT Telekanal.hbm.xml: http://pastebin.com/4c3h0fZj Programm class:http://pastebin.com/ws57uGg2 Telekanal class:http://pastebin.com/MZB7KgT1 Or maybe I have problem in my sql setup: http://pastebin.com/AVBM8882 And also I'm using opensessioninview for keeping the session open My code Really hope that someone can help


<list name="programmid" inverse="false" table="programm" lazy="true">
    <key>
        <column name="t_id" />
    </key>
    <list-index></list-index>
    <one-to-many class="com.tvkava.shared.model.Programm" />
</list>

Shouldn't declaring an empty list-index cause an error? I'm not sure how this would work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜