<commit_before>package com.ppa8ball.service;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Order;

import com.ppa8ball.models.Season;

public class SeasonServiceImpl implements SeasonService
{
	private Session session;
	
	public SeasonServiceImpl(Session session)
	{
		this.session = session;
	}

	@Override
	public void Save(Season season)
	{
		session.beginTransaction();
		session.saveOrUpdate(season);
		session.getTransaction().commit();
	}

	@Override
	public Season GetCurrent()
	{
		Criteria cr = session.createCriteria(Season.class);
		cr.addOrder(Order.desc("startYear"));

		@SuppressWarnings("unchecked")
		List<Season>  season = cr.list();
		
		return season.get(0);
	}

	@Override
	public Season Get(long id)
	{
		 return  (Season) session.get(Season.class, id);
	}<commit_msg>Changed season getCurrent implmention to sort in memory<commit_after>package com.ppa8ball.service;

import java.util.Collections;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Order;

import com.ppa8ball.models.Season;

public class SeasonServiceImpl implements SeasonService
{
	private Session session;
	
	public SeasonServiceImpl(Session session)
	{
		this.session = session;
	}

	@Override
	public void Save(Season season)
	{
		session.beginTransaction();
		session.saveOrUpdate(season);
		session.getTransaction().commit();
	}

	@Override
	public Season GetCurrent()
	{
		Criteria cr = session.createCriteria(Season.class);
		List<Season>  seasons = cr.list();
		Collections.sort(seasons ,Collections.reverseOrder());
		
		return seasons.get(0);
	}

	@Override
	public Season Get(long id)
	{
		 return  (Season) session.get(Season.class, id);
	}
{'fraction_non_alphanumeric': 0.11173498034811903, 'fraction_numerical': 0.003368893879842785, 'mean_word_length': 4.920265780730897, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '977861', 'n_tokens_mistral': 606, 'n_tokens_neox': 541, 'n_words': 121}