Thanks!

This is what I'm trying to do but I still get the exception.

This is from my DAO

@SuppressWarnings( "unchecked" )
public List<Collection> getCollections(){
   org.hibernate.Session hibernateSession =
(org.hibernate.Session)getEntityManager().getDelegate();
   return hibernateSession.createCriteria Collection.class 
,se.edgesoft.hairless.model.criteria.alias.Alias.COLLECTION.getAlias()).list();
}

I use the org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
before the wicket filter.
This is Entity manager and not sessionInView.

In my base class I spring inject my dao's using @SpringBean annotation.

Here is the model I'm using

IModel collectionModel = new LoadableDetachableModel(){
  private static final long serialVersionUID = 1L;
  protected Object load(){
    return getCollectionDao().getCollections();
  }
};


And it complains in my renderer

public class CollectionChoiceRenderer extends ChoiceRenderer {
        private static final long serialVersionUID = 1L;
        public Object getDisplayValue(Object object) {
        if (object instanceof Collection) {
                Collection  collection = ( Collection ) object;
                
                return collection.getIdentifier();
        }
        return null;
    }
    public String getIdValue(Object key, int index) {
        if (key instanceof Collection) {
                Collection collection = ( Collection ) key;
            return collection.getId().toString();
        }
        return null;
    }
}

Lazy loading exception when I try collection.getId().toString()

I thought this was detaching hibernate entities. The Collection class is a
hibernate annotated pojo.


-- 
View this message in context: 
http://www.nabble.com/How-to-avoid-Lazy-loading-exception-tp17040941p17044892.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to