| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
| HibernatePersistenceService |
|
| 0.0;0 |
| 1 | /* |
|
| 2 | * Copyright 2004 Chris Nelson |
|
| 3 | * |
|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | * you may not use this file except in compliance with the License. |
|
| 6 | * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
|
| 7 | * Unless required by applicable law or agreed to in writing, |
|
| 8 | * software distributed under the License is distributed on an "AS IS" BASIS, |
|
| 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 10 | * See the License for the specific language governing permissions and limitations under the License. |
|
| 11 | */ |
|
| 12 | package org.trails.persistence; |
|
| 13 | ||
| 14 | import java.util.List; |
|
| 15 | ||
| 16 | import org.hibernate.criterion.DetachedCriteria; |
|
| 17 | import org.trails.descriptor.IClassDescriptor; |
|
| 18 | ||
| 19 | ||
| 20 | public interface HibernatePersistenceService extends PersistenceService |
|
| 21 | { |
|
| 22 | ||
| 23 | public <T> T getInstance(Class<T> type, DetachedCriteria criteria); |
|
| 24 | public <T> List<T> getInstances(Class<T> type, DetachedCriteria criteria); |
|
| 25 | public <T> List<T> getInstances(Class<T> type, DetachedCriteria criteria, int startIndex, int maxResults); |
|
| 26 | ||
| 27 | public int count(Class type, DetachedCriteria criteria); |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @param model to attach to the current persistence session |
|
| 31 | */ |
|
| 32 | public void reattach(Object model); |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Does a query by example |
|
| 36 | * |
|
| 37 | * @param example |
|
| 38 | * @return |
|
| 39 | */ |
|
| 40 | public <T> List<T> getInstances(T example, IClassDescriptor classDescriptor); |
|
| 41 | ||
| 42 | public <T> T merge(T instance); |
|
| 43 | ||
| 44 | public <T> T saveOrUpdate(T instance); |
|
| 45 | ||
| 46 | public List find(String queryString); |
|
| 47 | public List find(String queryString, Object value); |
|
| 48 | public List find(String queryString, Object[] values); |
|
| 49 | } |