KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > ejb > test > connection > PersistenceInfoImpl


1 //$Id: PersistenceInfoImpl.java,v 1.2 2005/07/18 21:24:51 epbernard Exp $
2
package org.hibernate.ejb.test.connection;
3
4 import java.util.List JavaDoc;
5 import java.util.Properties JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.net.URL JavaDoc;
8 import javax.persistence.spi.PersistenceInfo;
9 import javax.sql.DataSource JavaDoc;
10
11 import org.hibernate.ejb.HibernatePersistence;
12 import org.hibernate.ejb.test.Item;
13 import org.hibernate.ejb.test.Distributor;
14 import org.hibernate.cfg.Environment;
15
16 /**
17  * @author Emmanuel Bernard
18  */

19 public class PersistenceInfoImpl implements PersistenceInfo {
20     private Properties JavaDoc properties = new Properties JavaDoc();
21     public String JavaDoc getEntityManagerName() {
22         return "persistenceinfo";
23     }
24
25     public String JavaDoc getPersistenceProviderClassName() {
26         return HibernatePersistence.class.getName();
27     }
28
29     public DataSource JavaDoc getJtaDataSource() {
30         return new FakeDataSource();
31     }
32
33     public DataSource JavaDoc getNonJtaDataSource() {
34         return null;
35     }
36
37     public List JavaDoc<String JavaDoc> getMappingFileNames() {
38         return new ArrayList JavaDoc<String JavaDoc>();
39     }
40
41     public List JavaDoc<URL JavaDoc> getJarFiles() {
42         return new ArrayList JavaDoc<URL JavaDoc>();
43     }
44
45     public List JavaDoc<String JavaDoc> getEntityclassNames() {
46         List JavaDoc<String JavaDoc> classes = new ArrayList JavaDoc<String JavaDoc>();
47         classes.add( Item.class.getName() );
48         classes.add( Distributor.class.getName() );
49         return classes;
50     }
51
52     public Properties JavaDoc getProperties() {
53         properties.setProperty( Environment.HBM2DDL_AUTO, "create-drop");
54         return properties;
55     }
56
57     public ClassLoader JavaDoc getClassLoader() {
58         return Thread.currentThread().getContextClassLoader();
59     }
60
61     public URL JavaDoc getPersistenceXmlFileUrl() {
62         return null;
63     }
64
65     public URL JavaDoc getEntityMappingsXmlFileUrl() {
66         return null;
67     }
68 }
69
Popular Tags