package de.fussballmanager.db.service;

import java.util.List;

import javax.persistence.EntityManager;

import com.mysema.query.jpa.impl.JPAQuery;

import de.fussballmanager.db.entity.tick.QTick;
import de.fussballmanager.db.entity.tick.Tick;
import de.fussballmanager.db.jpa.QueryBuilder;

public class TickServiceBusiness {

	EntityManager em;

	public List<Tick> getTicks() {
		new QueryBuilder(em, QTick.tick);
		JPAQuery selectQuery = new QueryBuilder(em, QTick.tick).select(null);
		List<Tick> resultList = selectQuery.list(QTick.tick);
		return resultList;
	}

	public void save(Tick aTick) {
		if (aTick.getPersistend()) {
			em.merge(aTick);
		} else {
			aTick.setLastChangedTime(System.currentTimeMillis());
			aTick.setPersistend(Boolean.TRUE);
			em.persist(aTick);
		}
	}

}

@@ -625,16 +625,73 @@
 nd()) %7B%0A
+%09%09%09aTick.setLastChangedTime(System.currentTimeMillis());%0A
 %09%09%09em.me

add setLastChangedTime to merge fork