package org.wamblee.mythtv;
-import java.sql.SQLException;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.criterion.Expression;
-import org.springframework.orm.hibernate3.HibernateCallback;
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-import org.springframework.orm.jpa.JpaTemplate;
-import org.springframework.orm.jpa.support.JpaDaoSupport;
/**
*
*/
-public class RecordingDatabase extends JpaDaoSupport {
+public class RecordingDatabase {
private static final Log LOG = LogFactory.getLog(RecordingDatabase.class);
-
- public RecordingDatabase() {
- // Empty
- }
- public void init() {
- /*
- for (Recording recording: (List<Recording>)getHibernateTemplate().loadAll(Recording.class) ) {
- LOG.info("Found recording " + recording);
- }
- LOG.info("After listing recordings");
- */
+ private EntityManager _entityManager;
+
+ public RecordingDatabase(EntityManager aEntityManager) {
+ _entityManager = aEntityManager;
}
public Recording findRecording(final String aName) {
- JpaTemplate jpaTemplate = getJpaTemplate();
- EntityManager entityManager = jpaTemplate.getEntityManager();
- Query query = entityManager.createQuery(
+ Query query = _entityManager.createQuery(
"select r from Recording r where r.basename = ?1");
query.setParameter(1, aName);
List<Recording> result = query.getResultList();
}
public void update(Recording aRecording) {
- getJpaTemplate().getEntityManager().merge(aRecording);
+ _entityManager.merge(aRecording);
}
}
org.wamblee.mythtv.datasource=jdbc/mythtv
-org.wamblee.mythtv.pollinterval=120
-org.wamblee.mythtv.monitordir=/data/vcr
-org.wamblee.mythtv.linkdir=/data/vcr/links
+org.wamblee.mythtv.pollinterval=2
+#org.wamblee.mythtv.monitordir=/data/vcr
+#org.wamblee.mythtv.linkdir=/data/vcr/links
-#org.wamblee.mythtv.monitordir=/ext/home/erik/java/workspace/utils/mythtv/testdata/input
-#org.wamblee.mythtv.linkdir=/ext/home/erik/java/workspace/utils/mythtv/testdata/links
+org.wamblee.mythtv.monitordir=/ext/home/erik/java/workspace/utils/mythtv/testdata/input
+org.wamblee.mythtv.linkdir=/ext/home/erik/java/workspace/utils/mythtv/testdata/links