KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > database > HibernateService


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.services.database;
6
7 import java.io.Serializable JavaDoc;
8 import net.sf.hibernate.Session;
9 import net.sf.hibernate.SessionFactory ;
10
11 /**
12  * Created by The eXo Platform SARL .
13  * Author : Tuan Nguyen
14  * tuan08@users.sourceforge.net
15  * Date: Jun 14, 2003
16  * Time: 1:12:22 PM
17  */

18 public interface HibernateService {
19   static final String JavaDoc DIALECT_PROPERTY = "hibernate.dialect";
20   static final String JavaDoc SHOW_SQL_PROPERTY = "hibernate.show_sql";
21   static final String JavaDoc REFLECTION_OPTIMIZER_PROPERTY = "hibernate.cglib.use_reflection_optimizer";
22   static final String JavaDoc CONNECTION_PROVIDER_PROPERTY = "hibernate.connection.provider_class";
23   
24   public String JavaDoc getServiceName() ;
25   
26   public Session openSession() throws Exception JavaDoc ;
27   public Session openNewSession() throws Exception JavaDoc ;
28   public void closeSession(Session session) ;
29   /**Close the session that assign to the current thread */
30   public void closeSession() ;
31   public Object JavaDoc findOne(Session session, String JavaDoc query, String JavaDoc id) throws Exception JavaDoc ;
32   public Object JavaDoc findExactOne(Session session, String JavaDoc query, String JavaDoc id) throws Exception JavaDoc ;
33   public Object JavaDoc findOne(Class JavaDoc clazz, java.io.Serializable JavaDoc id) throws Exception JavaDoc ;
34   public Object JavaDoc findOne(ObjectQuery q) throws Exception JavaDoc ;
35   public Object JavaDoc create(Object JavaDoc obj) throws Exception JavaDoc ;
36   public Object JavaDoc update(Object JavaDoc obj) throws Exception JavaDoc ;
37   public Object JavaDoc save(Object JavaDoc obj) throws Exception JavaDoc ;
38   public Object JavaDoc remove(Object JavaDoc obj) throws Exception JavaDoc ;
39   public Object JavaDoc remove(Class JavaDoc clazz , Serializable JavaDoc id) throws Exception JavaDoc ;
40   public Object JavaDoc remove(Session session ,Class JavaDoc clazz , Serializable JavaDoc id) throws Exception JavaDoc ;
41   
42   public SessionFactory getSessionFactory() throws Exception JavaDoc ;
43   public void addMappingFiles(String JavaDoc[] url) ;
44   
45 }
Popular Tags