-->
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: cannot access loading collection
PostPosted: Sat Nov 06, 2004 2:44 am 
Regular
Regular

Joined: Mon Aug 02, 2004 9:33 am
Posts: 69
Hibernate version:2.1.6

Code between sessionFactory.openSession() and session.close():

POJO
==========================
/**
* @hibernate.set role="image" table="image"
* cascade="all" lazy="true" inverse="true"
* @hibernate.collection-key column="FK_POSTID"
* @hibernate.collection-one-to-many class="com.stufftolet.model.businessobject.Posting.Image"
* @return
*/
public Set Image() {
return image;
}
==========================

HibernateImpl
===========================
public List getPostingDetail(final String postId){
return getHibernateTemplate().findByNamedQuery("PostingDetail",postId);
}
============================
* @hibernate.query name="PostingDetail"
* query="from PostingIdentification pid where pid.postid = ?"


Full stack trace of any exception that occurs:
net.sf.hibernate.LazyInitializationException: cannot access loading collection


Name and version of the database you are using:Mysql 4

Hi guys,

Initially the data access worked fine. But after trying the commonclipse by adding something like

/**
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object object) {
if (!(object instanceof Status)) {
return false;
}
Status rhs = (Status) object;
return new EqualsBuilder().append(this.user, rhs.user).append(
this.name, rhs.name).append(this.id, rhs.id).isEquals();
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return new HashCodeBuilder(-410945823, 1413238807).append(this.user)
.append(this.name).append(this.id).toHashCode();
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("name", this.name).append("id", this.id).append("user",
this.user).toString();
}


and trying to get the detail posting, I got the exception above. Pls help !! Thanks !


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.