001    /*
002     * Copyright © Sartini IT Solutions, 2010.
003     */
004    
005    package org.tynamo.jpa.sample.services;
006    
007    import org.tynamo.jpa.sample.domain.TestEntity;
008    import org.apache.tapestry5.ioc.annotations.Inject;
009    
010    import javax.persistence.EntityManager;
011    import java.util.Date;
012    
013    /**
014     * Created by IntelliJ IDEA.
015     * User: ps
016     * Date: 13.01.2010
017     * Time: 15:15:30
018     * To change this template use File | Settings | File Templates.
019     */
020    public class TestServiceImpl implements TestService {
021            @Inject private EntityManager em;
022            public void addTestEntity() {
023                    TestEntity te = new TestEntity();
024                    te.setValue(new Date().getTime()+"");
025                    em.persist(te);
026            }
027    
028            public void removeTestEntity(long id) {
029                    TestEntity te = em.find(TestEntity.class, id);
030                    em.remove(te);  
031            }
032    }