001 package railo.runtime.orm.hibernate.tuplizer; 002 import org.hibernate.EntityNameResolver; 003 004 import railo.runtime.Component; 005 import railo.runtime.exp.PageException; 006 import railo.runtime.orm.hibernate.HibernateCaster; 007 import railo.runtime.orm.hibernate.HibernateRuntimeException; 008 009 010 public class CFCEntityNameResolver implements EntityNameResolver { 011 public static final CFCEntityNameResolver INSTANCE = new CFCEntityNameResolver(); 012 013 /** 014 * {@inheritDoc} 015 */ 016 public String resolveEntityName(Object entity) { 017 try { 018 Component cfc = HibernateCaster.toComponent(entity); 019 return HibernateCaster.getEntityName(cfc); 020 } catch (PageException e) { 021 //print.printST(e); 022 throw new HibernateRuntimeException(e); 023 } 024 } 025 026 /** 027 * {@inheritDoc} 028 */ 029 public boolean equals(Object obj) { 030 return getClass().equals( obj.getClass() ); 031 } 032 033 /** 034 * {@inheritDoc} 035 */ 036 public int hashCode() { 037 return getClass().hashCode(); 038 } 039 }