@Test public void testDeleteEntry() { ClientResponse resp = client.delete("http: assertEquals(ResponseType.SUCCESS, resp.getType()); resp.release(); resp = client.get("http: Document<Feed> feed_doc = resp.getDocument(); Feed feed = feed_doc.getRoot(); assertEquals(0, feed.getEntries().size()); resp.release(); }
@Override public boolean deleteEntry(Object entryId) throws Exception { Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); boolean deleted = false; try { Object mapping = session.load( Class.forName((String) config.getProperty(ENTRY_MAPPING_CLASS_NAME)), (Serializable) entryId); if (mapping != null) { session.delete(mapping); tx.commit(); } deleted = true; } catch (HibernateException ex) { tx.rollback(); logger.error("error deleting the entry", ex); } finally { session.close(); } return deleted; }
HibernateCollectionAdapter extends BasicAdapter { @Override public boolean deleteEntry(Object entryId) throws Exception { Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); boolean deleted = false; try { Object mapping = session.load( Class.forName((String) config.getProperty(ENTRY_MAPPING_CLASS_NAME)), (Serializable) entryId); if (mapping != null) { session.delete(mapping); tx.commit(); } deleted = true; } catch (HibernateException ex) { tx.rollback(); logger.error("error deleting the entry", ex); } finally { session.close(); } return deleted; } }
HibernateCollectionAdapter extends BasicAdapter { @Override public boolean deleteEntry(Object entryId) throws Exception { Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); boolean deleted = false; try { Object mapping = session.load( Class.forName((String) config.getProperty(ENTRY_MAPPING_CLASS_NAME)), (Serializable) entryId); if (mapping != null) { session.delete(mapping); tx.commit(); } deleted = true; } catch (HibernateException ex) { tx.rollback(); logger.error("error deleting the entry", ex); } finally { session.close(); } return deleted; } HibernateCollectionAdapter(Abdera abdera, FeedConfiguration config); }
HibernateCollectionAdapter extends BasicAdapter { @Override public boolean deleteEntry(Object entryId) throws Exception { Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); boolean deleted = false; try { Object mapping = session.load( Class.forName((String) config.getProperty(ENTRY_MAPPING_CLASS_NAME)), (Serializable) entryId); if (mapping != null) { session.delete(mapping); tx.commit(); } deleted = true; } catch (HibernateException ex) { tx.rollback(); logger.error("error deleting the entry", ex); } finally { session.close(); } return deleted; } HibernateCollectionAdapter(Abdera abdera, FeedConfiguration config); @Override Entry createEntry(Entry entry); @Override boolean deleteEntry(Object entryId); @Override Entry getEntry(Object entryId); @Override Feed getFeed(); @Override Entry updateEntry(Object entryId, Entry entry); }
HibernateCollectionAdapter extends BasicAdapter { @Override public boolean deleteEntry(Object entryId) throws Exception { Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); boolean deleted = false; try { Object mapping = session.load( Class.forName((String) config.getProperty(ENTRY_MAPPING_CLASS_NAME)), (Serializable) entryId); if (mapping != null) { session.delete(mapping); tx.commit(); } deleted = true; } catch (HibernateException ex) { tx.rollback(); logger.error("error deleting the entry", ex); } finally { session.close(); } return deleted; } HibernateCollectionAdapter(Abdera abdera, FeedConfiguration config); @Override Entry createEntry(Entry entry); @Override boolean deleteEntry(Object entryId); @Override Entry getEntry(Object entryId); @Override Feed getFeed(); @Override Entry updateEntry(Object entryId, Entry entry); static final String HIBERNATE_ANNOTATION_CONFIG; static final String HIBERNATE_CFG_PATH; static final String ENTRY_MAPPING_CLASS_NAME; }