Announcement Announcement Module
Collapse
No announcement yet.
dynamic proxies och hibernate Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic proxies och hibernate

    I'm sorry for cross posting. I just couldn't decide what would be the proper forum. I will copy the answers to the other post.
    ------------
    Hi all,
    I'm integrating hibernate with spring's acegi (security framework). I want to add security checks on a persisted objects methods.
    Becuase it is spring, I add a proxy (dynamic or cglib) with in front of the actual method. This all works fine but when use it together with load runner. The class is of course different.
    Hibernate complains that it does not have a persister for the specific class.

    What I do in detail, is that in the instantiate-method in hibernate's interceptor:
    -----
    public Object instantiate(Class clazz, Serializable id) throws CallbackException {

    create object with a spring proxy in front
    return the object.

    }

    Later when it loads it I get the error:
    net.sf.hibernate.MappingException: No persister for: no.abmu.organisationregister.domain.LanguageImpl$$ EnhancerByCGLIB$$ffe2eb75
    at net.sf.hibernate.impl.SessionFactoryImpl.getPersis ter(SessionFactoryImpl.java:347)
    at net.sf.hibernate.impl.SessionImpl.getClassPersiste r(SessionImpl.java:2690)
    at net.sf.hibernate.impl.SessionImpl.getPersister(Ses sionImpl.java:2697)
    at net.sf.hibernate.loader.Loader.loadFromResultSet(L oader.java:619)
    at net.sf.hibernate.loader.Loader.instanceNotYetLoade d(Loader.java:586)
    at net.sf.hibernate.loader.Loader.getRow(Loader.java: 501)
    at net.sf.hibernate.loader.Loader.getRowFromResultSet (Loader.java:213)
    at net.sf.hibernate.loader.Loader.doQuery(Loader.java :281)
    at net.sf.hibernate.loader.Loader.doQueryAndInitializ eNonLazyCollections(Loader.java:133)
    at net.sf.hibernate.loader.Loader.doList(Loader.java: 1033)
    at net.sf.hibernate.loader.Loader.list(Loader.java:10 24)
    at net.sf.hibernate.hql.QueryTranslator.list(QueryTra nslator.java:854)
    at net.sf.hibernate.impl.SessionImpl.find(SessionImpl .java:1544)

    Of course not really surpringsly but I expected to solve this somehow, but I have to admit that I'm stuck.

    The problem is general in the sense that it would be nice to add a dynamic proxy to a persistent object for other reasons than the above.

    Does anyone have any suggestions?

    I know that there are a number of workarounds but this will be by far the most simple.
    Regards
    Erik Romson

  • #2
    Hi Erik

    This one definitely belongs in the data access forum, as it's not related to Acegi Security functionality. If you search for CGLIB enhanced Hibernate, IIRC there some discussion on this issue in the spring-users list.

    Comment

    Working...
    X