Results 1 to 2 of 2

Thread: dynamic proxies och hibernate

  1. #1
    Join Date
    Dec 2004
    Posts
    5

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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.

Similar Threads

  1. Replies: 5
    Last Post: Dec 27th, 2005, 07:00 AM
  2. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  3. dynamic proxies och hibernate
    By erik_romson in forum Data
    Replies: 3
    Last Post: Dec 18th, 2004, 04:19 AM
  4. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  5. Replies: 7
    Last Post: Aug 21st, 2004, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •