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 !
|