-->
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: @Loader and @NativeNamedQuery
PostPosted: Tue Feb 19, 2013 10:06 am 
Newbie

Joined: Mon Nov 10, 2008 5:23 am
Posts: 3
Hey Folks,
i've a problem using the @loader annotation on a @OneToMany. As it looks like from the log, at least the row is found through the query but the collection stays null.
I searched the web a lot, but didn't found things, that were really helping. Maybe you have an idea?
thanks a lot :9

Code:
14:52:26,765 DEBUG ConcurrentStatisticsImpl:411 - HHH000117: HQL: SELECT * FROM impact_study impStud WHERE impStud.Study_id = ?, time: 15ms, rows: 1
14:52:26,770 TRACE SessionImpl:1367 - Setting flush mode to: AUTO
14:52:26,771 TRACE DefaultInitializeCollectionEventListener:83 - Collection initialized
Exception in thread "main" java.lang.NullPointerException
   at org.hibernate.collection.internal.PersistentBag.size(PersistentBag.java:242)
   at com.bayer.sam.parser.sam.help.Blub.main(Blub.java:28)


Code:
@NamedNativeQuery(name = "loadImpStudyByID",
query = "SELECT * FROM impact_study impStud WHERE impStud.Study_id = ?", resultClass=ImpactStudy.class)
public class SamStudy extends SamEntity implements Serializable {

.......

@OneToMany(fetch=FetchType.LAZY)
@Loader(namedQuery="loadImpStudyByID")
private Collection<ImpactStudy> mImpactStudy = new ArrayList<ImpactStudy>();


Code:
@Table(name = "impact_study")
public class ImpactStudy implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = ImpactParser.studyId)
    private Integer studyNo;


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.