py.com.palermo.servicioarthy.PuntosService.java Source code

Java tutorial

Introduction

Here is the source code for py.com.palermo.servicioarthy.PuntosService.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.palermo.servicioarthy;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.joda.time.LocalDateTime;
import org.joda.time.format.DateTimeFormat;
import py.com.palermo.servicioarthy.modelo.Evento;

/**
 *
 * @author cromero
 */
@Stateless
public class PuntosService {

    @PersistenceContext(unitName = "PuntosPU")
    private EntityManager em;

    public void guarda(Evento e) {

        if (e.getFechaCadena() != null) {
            LocalDateTime localDateTime = LocalDateTime.parse(e.getFechaCadena(),
                    DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ"));
            e.setFecha(localDateTime.toDate());
        }

        em.merge(e);
    }
}