站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss Seam 1.1.6 API 英文版文档

HibernateFactory (JBoss Seam API Documentation) - JBoss Seam 1.1.6 API 英文版文档


org.jboss.seam.microcontainer
Class HibernateFactory

java.lang.Object
  extended by org.jboss.seam.microcontainer.HibernateFactory
Direct Known Subclasses:
HibernateSessionFactory

public class HibernateFactory
extends Object

A factory that bootstraps a Hibernate SessionFactory.

Loads Hibernate configuration options by checking:

  • hibernate.properties in root of the classpath
  • hibernate.cfg.xml in root of the classpath
  • cfgResourceName as location of a cfg.xml file
  • factory-suplied cfgProperties options

    Note that this factory only supports cfg.xml files or programmatic cfgProperties supplied to the factory. Any hibernate.properties are always loaded from the classpath.

    Mapping metadata can be supplied through:

  • mappingClasses: equivalent to <mapping class="..."/>
  • mappingFiles: equivalent to <mapping file="..."/>
  • mappingJars: equivalent to <mapping jar="..."/>
  • mappingPackages: equivalent to <mapping package="..."/>
  • mappingResources: equivalent to <mapping resource="..."/>

    or through cfg.xml files.

    The jndiProperties are convenience, the factory will automatically prefix regular JNDI properties for use as Hibernate configuration properties.

    Author:
    Gavin King, Christian Bauer

    Constructor Summary
    HibernateFactory()
               
     
    Method Summary
    protected  org.hibernate.SessionFactory createSessionFactory()
               
     Map<String,String> getCfgProperties()
               
     String getCfgResourceName()
               
     List<String> getMappingClasses()
               
     List<String> getMappingFiles()
               
     List<String> getMappingJars()
               
     List<String> getMappingPackages()
               
     List<String> getMappingResources()
               
     org.hibernate.SessionFactory getSessionFactory()
               
     void setCfgProperties(Map<String,String> cfgProperties)
               
     void setCfgResourceName(String cfgFileName)
               
     void setMappingClasses(List<String> mappingClasses)
               
     void setMappingFiles(List<String> mappingFiles)
               
     void setMappingJars(List<String> mappingJars)
               
     void setMappingPackages(List<String> mappingPackages)
               
     void setMappingResources(List<String> mappingResources)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    HibernateFactory

    public HibernateFactory()
    Method Detail

    getSessionFactory

    public org.hibernate.SessionFactory getSessionFactory()
                                                   throws Exception
    Throws:
    Exception

    createSessionFactory

    protected org.hibernate.SessionFactory createSessionFactory()
                                                         throws ClassNotFoundException
    Throws:
    ClassNotFoundException

    getCfgResourceName

    public String getCfgResourceName()

    setCfgResourceName

    public void setCfgResourceName(String cfgFileName)

    getCfgProperties

    public Map<String,String> getCfgProperties()

    setCfgProperties

    public void setCfgProperties(Map<String,String> cfgProperties)

    getMappingClasses

    public List<String> getMappingClasses()

    setMappingClasses

    public void setMappingClasses(List<String> mappingClasses)

    getMappingFiles

    public List<String> getMappingFiles()

    setMappingFiles

    public void setMappingFiles(List<String> mappingFiles)

    getMappingJars

    public List<String> getMappingJars()

    setMappingJars

    public void setMappingJars(List<String> mappingJars)

    getMappingPackages

    public List<String> getMappingPackages()

    setMappingPackages

    public void setMappingPackages(List<String> mappingPackages)

    getMappingResources

    public List<String> getMappingResources()

    setMappingResources

    public void setMappingResources(List<String> mappingResources)