/*
 * Copyright 2008-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.data.ebean.repository;

import io.ebean.EbeanServer;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.io.Serializable;
import java.util.List;

/**
 * Ebean specific extension of {@link org.springframework.data.repository.Repository}.
 *
 * @author Xuegui Yuan
 */
@NoRepositoryBean
public interface EbeanRepository<T, ID extends Serializable> extends PagingAndSortingRepository<T, ID> {

    EbeanServer db();

    EbeanServer db(EbeanServer db);


    /*
     * (non-Javadoc)
     * @see org.springframework.data.repository.CrudRepository#findAll()
     */
    List<T> findAll();

    /*
     * (non-Javadoc)
     * @see org.springframework.data.repository.PagingAndSortingRepository#findAll(org.springframework.data.domain.Sort)
     */
    List<T> findAll(Sort sort);

    /*
     * (non-Javadoc)
     * @see org.springframework.data.repository.CrudRepository#findAll(java.lang.Iterable)
     */
    List<T> findAll(Iterable<ID> ids);

    /*
     * (non-Javadoc)
     * @see org.springframework.data.repository.CrudRepository#save(java.lang.Iterable)
     */
    <S extends T> List<S> save(Iterable<S> entities);

    T findOne(ID id, String selects);

    List<T> findAll(String selects);

    List<T> findAll(Iterable<ID> ids, String selects);

    List<T> findAll(Sort sort, String selects);

    Page<T> findAll(Pageable pageable, String selects);

}

@@ -1273,26 +1273,260 @@
     
-EbeanServer db();%0A
+/**%0A     * Return the current EbeanServer%0A     *%0A     * @return the current EbeanServer%0A     */%0A    EbeanServer db();%0A%0A    /**%0A     * Set the current EbeanServer%0A     *%0A     * @param db current EbeanServer%0A     * @return the current EbeanServer%0A     */
 %0A   
@@ -1559,17 +1559,16 @@
 r db);%0A%0A
-%0A
     /*%0A 
@@ -2236,185 +2236,1439 @@
     
-T findOne(ID id, String selects);%0A%0A    List%3CT%3E findAll(String selects);%0A%0A    List%3CT%3E findAll(Iterable%3CID%3E ids, String selects);%0A%0A    List%3CT%3E findAll(Sort sort, String selects);%0A
+/**%0A     * Retrieves an entity by its id and select return entity properties with FetchPath string%0A     * @param id ID%0A     * @param selects FetchPath string%0A     * @return the entity only select/fetch with FetchPath string%0A     */%0A    T findOne(ID id, String selects);%0A%0A    /**%0A     * Returns all entities and select return entity properties with FetchPath string%0A     * @param selects FetchPath string%0A     * @return all entities only select/fetch with FetchPath string%0A     */%0A    List%3CT%3E findAll(String selects);%0A%0A    /**%0A     * Returns all entities in ids and select return entity properties with FetchPath string%0A     * @param ids ID list%0A     * @param selects FetchPath string%0A     * @return all entities by id in ids and select/fetch with FetchPath string%0A     */%0A    List%3CT%3E findAll(Iterable%3CID%3E ids, String selects);%0A%0A    /**%0A     * Returns all entities sorted by the given options and select return entity properties with FetchPath string.%0A     * @param sort%0A     * @param selects%0A     * @return all entities sorted and select/fetch with FetchPath string%0A     */%0A    List%3CT%3E findAll(Sort sort, String selects);%0A%0A    /**%0A     * Returns a %7B@link Page%7D of entities meeting the paging restriction provided in the %7B@code Pageable%7D object%0A     * and select return entity properties with FetchPath string.%0A     * @param pageable%0A     * @param selects%0A     * @return a page of entities select/fetch with FetchPath string%0A     */
 %0A   

add comment on EbeanRepository