@Test public void deleteProductReferences () { Long fid0 = Long.valueOf (0); Long fid1 = Long.valueOf (1); FileScanner fs0 = dao.read (fid0); FileScanner fs1 = dao.read (fid1); Collection c = cdao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"); assertTrue (fs0.getCollections ().contains (c)); assertTrue (fs1.getCollections ().contains (c)); int updated = dao.deleteCollectionReferences (c); dao.getSessionFactory ().getCurrentSession ().refresh (fs0); dao.getSessionFactory ().getCurrentSession ().refresh (fs1); assertEquals (updated, 2); assertFalse (fs0.getCollections ().contains (c)); assertFalse (fs1.getCollections ().contains (c)); }
public int deleteCollectionReferences(final Collection collection) { return getHibernateTemplate().execute ( new HibernateCallback<Integer>() { public Integer doInHibernate(Session session) throws HibernateException, SQLException { String sql = "DELETE FROM FILESCANNER_COLLECTIONS s " + " WHERE s.COLLECTIONS_UUID = :cid"; SQLQuery query = session.createSQLQuery(sql); query.setString ("cid", collection.getUUID()); return query.executeUpdate (); } }); }
FileScannerDao extends HibernateDao<FileScanner, Long> { public int deleteCollectionReferences(final Collection collection) { return getHibernateTemplate().execute ( new HibernateCallback<Integer>() { public Integer doInHibernate(Session session) throws HibernateException, SQLException { String sql = "DELETE FROM FILESCANNER_COLLECTIONS s " + " WHERE s.COLLECTIONS_UUID = :cid"; SQLQuery query = session.createSQLQuery(sql); query.setString ("cid", collection.getUUID()); return query.executeUpdate (); } }); } }
FileScannerDao extends HibernateDao<FileScanner, Long> { public int deleteCollectionReferences(final Collection collection) { return getHibernateTemplate().execute ( new HibernateCallback<Integer>() { public Integer doInHibernate(Session session) throws HibernateException, SQLException { String sql = "DELETE FROM FILESCANNER_COLLECTIONS s " + " WHERE s.COLLECTIONS_UUID = :cid"; SQLQuery query = session.createSQLQuery(sql); query.setString ("cid", collection.getUUID()); return query.executeUpdate (); } }); }  }
FileScannerDao extends HibernateDao<FileScanner, Long> { public int deleteCollectionReferences(final Collection collection) { return getHibernateTemplate().execute ( new HibernateCallback<Integer>() { public Integer doInHibernate(Session session) throws HibernateException, SQLException { String sql = "DELETE FROM FILESCANNER_COLLECTIONS s " + " WHERE s.COLLECTIONS_UUID = :cid"; SQLQuery query = session.createSQLQuery(sql); query.setString ("cid", collection.getUUID()); return query.executeUpdate (); } }); }  int deleteCollectionReferences(final Collection collection); @SuppressWarnings ("unchecked") List<String> getScannerCollections(final Long scan_id); @Override void delete(final FileScanner scanner); void resetAll(); User getUserFromScanner(FileScanner fs); boolean exists(final FileScanner file_scanner); }
FileScannerDao extends HibernateDao<FileScanner, Long> { public int deleteCollectionReferences(final Collection collection) { return getHibernateTemplate().execute ( new HibernateCallback<Integer>() { public Integer doInHibernate(Session session) throws HibernateException, SQLException { String sql = "DELETE FROM FILESCANNER_COLLECTIONS s " + " WHERE s.COLLECTIONS_UUID = :cid"; SQLQuery query = session.createSQLQuery(sql); query.setString ("cid", collection.getUUID()); return query.executeUpdate (); } }); }  int deleteCollectionReferences(final Collection collection); @SuppressWarnings ("unchecked") List<String> getScannerCollections(final Long scan_id); @Override void delete(final FileScanner scanner); void resetAll(); User getUserFromScanner(FileScanner fs); boolean exists(final FileScanner file_scanner);  }