KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.jboss.portal.setup.impl.dl.dbloader.SqlFunctionMetaData;
12 import org.jboss.portal.setup.PortalSetupException;
13 import org.hibernate.dialect.Dialect;
14
15
16
17 import java.sql.Date JavaDoc;
18
19 /**
20  * @author <a HREF="mailto:palber@novell.com">Polina Alber</a>
21  * Date: Apr 27, 2005; Time: 6:54:43 PM
22  * @since JBoss portal 2.0
23  * Class org.jboss.portal.setup.impl.dl.dbloader.hibernate.HibernateSqlFunctionmetaData
24  */

25 public class HibernateSqlFunctionmetaData extends SqlFunctionMetaData
26 {
27    HibernateSqlFunctionmetaData(String JavaDoc funcStr)
28    {
29       super(funcStr);
30    }
31
32    public Object JavaDoc resolveSQLFunction(Dialect dbVendor) throws PortalSetupException
33    {
34       if ("now".equalsIgnoreCase(getFuncName()))
35       {
36          return new Date JavaDoc(System.currentTimeMillis());
37       }
38       else
39       {
40          throw new PortalSetupException("Specified function: " +
41             (getFuncName() + " is not supported by hibernate dialect: " +
42             dbVendor));
43       }
44    }
45 }
46
Popular Tags