001 package railo.runtime.orm.hibernate.tuplizer.accessors; 002 003 import java.lang.reflect.Method; 004 005 import org.hibernate.HibernateException; 006 import org.hibernate.engine.SessionFactoryImplementor; 007 import org.hibernate.property.Setter; 008 009 import railo.runtime.Component; 010 import railo.runtime.exp.PageException; 011 import railo.runtime.op.Caster; 012 import railo.runtime.orm.hibernate.HibernateRuntimeException; 013 import railo.runtime.type.Collection; 014 import railo.runtime.type.Collection.Key; 015 import railo.runtime.type.KeyImpl; 016 import railo.runtime.type.util.ComponentUtil; 017 018 public final class CFCSetter implements Setter { 019 020 private Key key; 021 022 /** 023 * Constructor of the class 024 * @param key 025 */ 026 public CFCSetter(String key){ 027 this(KeyImpl.getInstance(key)); 028 } 029 030 /** 031 * Constructor of the class 032 * @param key 033 */ 034 public CFCSetter(Collection.Key key){ 035 this.key=key; 036 } 037 038 /** 039 * @see org.hibernate.property.Setter#getMethodName() 040 */ 041 public String getMethodName() { 042 return null; 043 } 044 045 /** 046 * @see org.hibernate.property.Setter#getMethod() 047 */ 048 public Method getMethod() { 049 return null; 050 } 051 052 /** 053 * {@inheritDoc} 054 */ 055 public void set(Object trg, Object value, SessionFactoryImplementor factory) throws HibernateException { 056 try { 057 Component cfc = Caster.toComponent(trg); 058 //ComponentUtil.toComponentPro(cfc).getComponentScope().set(key,HibernateCaster.toCFML(value));// MUST HibernateCaster 059 ComponentUtil.toComponentPro(cfc).getComponentScope().set(key,value); 060 } 061 catch (PageException e) { 062 throw new HibernateRuntimeException(e); 063 } 064 } 065 066 }