-->
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: org.hibernate.LazyInitializationException confusion
PostPosted: Fri Apr 08, 2011 10:39 pm 
Newbie

Joined: Fri Apr 08, 2011 10:30 pm
Posts: 1
I'm getting this exception anytime I try to load a table that has an associated transient table. The strange thing is I only see this if I load a single entry, if I load all I don't get the error.

getHibernateTemplate().get(entityClass, id) FAILS

getHibernateTemplate().find(String.format("from %s", entityClass.getName() WORKS (it loads all entries but they are all correct and complete..

The class I'm querying is...

@Entity
public class MetaDatabaseGroup extends DatabaseGroup {
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name = "DATABASE_GROUP_MAP")
private Set<DatabaseGroup> databaseGroups;
...

The transient class is...

@Entity
public class StaticDatabaseGroup extends DatabaseGroup {
@ElementCollection( fetch = FetchType.EAGER )
@CollectionTable( name = "DB_GROUP_ELEMENT_MAP", joinColumns = @JoinColumn(name="DATABASE_GROUP_ID"))
@javax.persistence.Column( name="ElEMENT")
private Set<Long> externalIds;
...

So why might I be getting the lazy init error? Its not clear.

-Robert


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.