1 package org.hibernate.ejb; 3 4 import java.util.HashMap ; 5 import java.util.Map ; 6 import javax.sql.DataSource ; 7 8 import org.hibernate.HibernateException; 9 import org.hibernate.cfg.AnnotationConfiguration; 10 import org.hibernate.cfg.Settings; 11 12 15 public class Ejb3Configuration extends AnnotationConfiguration { 16 public Ejb3Configuration() { 17 super( new InjectionSettingsFactory() ); 18 } 19 20 public void setDataSource(DataSource ds) { 21 Map cpInjection = new HashMap (); 22 cpInjection.put( "dataSource", ds ); 23 ( (InjectionSettingsFactory) settingsFactory).setConnectionProviderInjectionData( cpInjection ); 24 } 25 26 public Settings buildSettings() throws HibernateException { 27 return settingsFactory.buildSettings( getProperties() ); 28 } 29 } 30 | Popular Tags |