001    package railo.runtime.orm.hibernate.tuplizer.proxy;
002    
003    import java.io.Serializable;
004    
005    import org.hibernate.engine.SessionImplementor;
006    import org.hibernate.proxy.AbstractLazyInitializer;
007    
008    import railo.runtime.exp.PageException;
009    import railo.runtime.op.Caster;
010    import railo.runtime.orm.hibernate.HibernateRuntimeException;
011    import railo.runtime.type.cfc.ComponentAccess;
012    import railo.runtime.type.util.ComponentUtil;
013    
014    /**
015     * Lazy initializer for "dynamic-map" entity representations.
016     * SLOW
017     */
018    public class CFCLazyInitializer extends AbstractLazyInitializer implements Serializable {
019    
020            
021            CFCLazyInitializer(String entityName, Serializable id, SessionImplementor session) {
022                    super(entityName, id, session);
023                    
024            }
025    
026            public ComponentAccess getCFC() {
027                    try {
028                            return ComponentUtil.toComponentAccess(Caster.toComponent(getImplementation()));
029                    } catch (PageException e) {
030                            throw new HibernateRuntimeException(e);
031                    }
032            }
033    
034            public Class getPersistentClass() {
035                    throw new UnsupportedOperationException("dynamic-map entity representation");
036            }
037            
038            
039            
040    }
041    
042    
043    
044