001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.orm.hibernate.tuplizer.proxy;
020
021import java.io.Serializable;
022
023import lucee.runtime.Component;
024import lucee.runtime.exp.PageException;
025import lucee.runtime.orm.hibernate.CommonUtil;
026import lucee.runtime.orm.hibernate.HibernatePageException;
027
028import org.hibernate.engine.SessionImplementor;
029import org.hibernate.proxy.AbstractLazyInitializer;
030
031/**
032 * Lazy initializer for "dynamic-map" entity representations.
033 * SLOW
034 */
035public class CFCLazyInitializer extends AbstractLazyInitializer implements Serializable {
036
037        
038        CFCLazyInitializer(String entityName, Serializable id, SessionImplementor session) {
039                super(entityName, id, session);
040                
041        }
042
043        public Component getCFC() {
044                try {
045                        return CommonUtil.toComponent(getImplementation());
046                } catch (PageException pe) {
047                        throw new HibernatePageException(pe);
048                }
049        }
050
051        public Class getPersistentClass() {
052                throw new UnsupportedOperationException("dynamic-map entity representation");
053        }
054        
055        
056        
057}
058
059
060
061