Announcement Announcement Module
No announcement yet.
dynamic proxies och hibernate Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • 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(
    at net.sf.hibernate.impl.SessionImpl.getClassPersiste r(
    at net.sf.hibernate.impl.SessionImpl.getPersister(Ses
    at net.sf.hibernate.loader.Loader.loadFromResultSet(L
    at net.sf.hibernate.loader.Loader.instanceNotYetLoade d(
    at net.sf.hibernate.loader.Loader.getRow( 501)
    at net.sf.hibernate.loader.Loader.getRowFromResultSet (
    at net.sf.hibernate.loader.Loader.doQuery( :281)
    at net.sf.hibernate.loader.Loader.doQueryAndInitializ eNonLazyCollections(
    at net.sf.hibernate.loader.Loader.doList( 1033)
    at net.sf.hibernate.loader.Loader.list( 24)
    at net.sf.hibernate.hql.QueryTranslator.list(QueryTra
    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.
    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.