<repo_name>KarolSz001/IODeliverSystemApp<file_sep>/README.md
"# IODeliverSystemApp" 
<file_sep>/repo/src/main/java/com/app/repo/impl/PaymentRepositoryImpl.java
package com.app.repo.impl;


import com.app.model.Payment;
import com.app.repo.generic.AbstractCrudRepository;
import com.app.repo.generic.PaymentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PaymentRepositoryImpl extends AbstractCrudRepository<Payment,Long> implements PaymentRepository {

    @Autowired

    public PaymentRepositoryImpl() {
        super();
    }
}
<file_sep>/repo/src/main/java/com/app/repo/impl/TradeRepositoryImpl.java
package com.app.repo.impl;

import com.app.model.Trade;
import com.app.repo.generic.AbstractCrudRepository;
import com.app.repo.generic.TradeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import java.util.Optional;
@Component
public class TradeRepositoryImpl extends AbstractCrudRepository<Trade, Long> implements TradeRepository {


    @Autowired

    public TradeRepositoryImpl() {
        super();
    }

    @Override
    public Optional<Trade> findByName(String name) {

        EntityManager em = null;
        EntityTransaction tx = null;
        Optional<Trade> tradeByName = Optional.empty();

        try {

            em = emf.createEntityManager();
            tx = em.getTransaction();
            tx.begin();

            tradeByName = em
                    .createQuery("select t from Trade t where t.name = :name", Trade.class)
                    .setParameter("name", name)
                    .getResultStream().findFirst();

            tx.commit();

        } catch (Exception e) {
            if (tx != null) {
                tx.rollback();
            }
            e.printStackTrace();

        } finally {
            if (em != null) {
                em.close();
            }
        }

        return tradeByName;
    }

}
<file_sep>/repo/src/main/java/com/app/repo/impl/ErrorRepositoryImpl.java
package com.app.repo.impl;


import com.app.repo.generic.AbstractCrudRepository;
import com.app.repo.generic.ErrorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ErrorRepositoryImpl extends AbstractCrudRepository<Error, Long> implements ErrorRepository {

    @Autowired

    public ErrorRepositoryImpl() {
        super();
    }

}
