KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > setup > impl > dl > dbloader > hibernate > MappingImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.setup.impl.dl.dbloader.hibernate;
10
11
12 import org.hibernate.engine.Mapping;
13 import org.hibernate.cfg.Mappings;
14 import org.hibernate.type.Type;
15 import org.hibernate.MappingException;
16 import org.hibernate.mapping.PersistentClass;
17
18 /**
19  * @author <a HREF="mailto:palber@novell.com">Polina Alber</a>
20  * Date: Apr 27, 2005; Time: 7:03:45 PM
21  * @since JBoss portal 2.0
22  * Class org.jboss.portal.setup.impl.dl.dbloader.hibernate.MappingImpl
23  */

24 public class MappingImpl implements Mapping
25 {
26    MappingImpl(Mappings mappings)
27    {
28       m_mappings = mappings;
29    }
30
31    Mappings m_mappings;
32
33    /**
34     * Returns the identifier type of a mapped class
35     */

36    public Type getIdentifierType(String JavaDoc persistentClass) throws MappingException
37    {
38
39       PersistentClass cl = m_mappings.getClass(persistentClass);
40       return m_mappings.getClass(persistentClass).getIdentifier().getType();
41
42    }
43
44    public String JavaDoc getIdentifierPropertyName(String JavaDoc persistentClass) throws MappingException
45    {
46       return m_mappings.getClass(persistentClass).getIdentifierProperty().getName();
47    }
48
49    public Type getPropertyType(String JavaDoc persistentClass, String JavaDoc propertyName) throws MappingException
50    {
51       PersistentClass cl = m_mappings.getClass(persistentClass);
52       return m_mappings.getClass(persistentClass).getProperty(propertyName).getType();
53    }
54
55 }
56
Popular Tags