/**
 * Copyright © 2011-2013 EMBL - European Bioinformatics Institute
 * 
 * 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 uk.ac.ebi.phenotype.dao;

/**
 * 
 * External data source access manager implementation.
 * 
 * @author Gautier Koscielny (EMBL-EBI) <koscieln@ebi.ac.uk>
 * @since February 2012
 */

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;

import uk.ac.ebi.phenotype.pojo.Datasource;



public class DatasourceDAOImpl extends HibernateDAOImpl implements
		DatasourceDAO {

	public DatasourceDAOImpl(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	@Transactional(readOnly = true)
	@SuppressWarnings("unchecked")
	public List<Datasource> getAllDatasources() {
		return getCurrentSession().createQuery("from Datasource").list();
	}

	@Transactional(readOnly = true)
	public Datasource getDatasourceByName(String name) {
		return (Datasource) getCurrentSession().createQuery("from Datasource as d where d.name= ?").setString(0, name).uniqueResult();
		
	}

	@Transactional(readOnly = true)
	public Datasource getDatasourceByShortName(String shortName) {
		return (Datasource) getCurrentSession().createQuery("from Datasource as d where d.shortName= ?").setString(0, shortName).uniqueResult();
		
	}
}

@@ -881,16 +881,126 @@
 actory;%0A
+import org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Service;%0A
 import o
@@ -1102,17 +1102,24 @@
 ource;%0A%0A
-%0A
+@Service
 %0Apublic 
@@ -1177,19 +1177,17 @@
 plements
-%0A%09%09
+ 
 Datasour
@@ -1200,74 +1200,21 @@
 %7B%0A%0A%09
-public DatasourceDAOImpl(SessionFactory sessionFactory) %7B%0A%09%09this.s
+@Autowired%0A%09S
 essi
@@ -1222,18 +1222,16 @@
 nFactory
- =
  session
@@ -1239,19 +1239,16 @@
 actory;%0A
-%09%7D%0A
 %09%0A%09@Tran

use annotations for DAO and entity configurations;