/** * This method always returns <code>true</code> * * @return <code>true</code> */ public boolean add(Object o) { ObjectConnection conn = getObjectConnection(); try { Value value = getValue(o); add(conn, getResource(), value); if (value instanceof Resource) { refreshEntity(); } } catch (RepositoryException e) { throw new ObjectPersistException(e); } refresh(); refresh(o); return true; }
/** * This method always returns <code>true</code> * * @return <code>true</code> */ public boolean add(Object o) { ObjectConnection conn = getObjectConnection(); try { Value value = getValue(o); add(conn, getResource(), value); if (value instanceof Resource) { refreshEntity(); } } catch (RepositoryException e) { throw new ObjectPersistException(e); } refresh(); refresh(o); return true; }
public boolean addAll(Collection<?> c) { ObjectConnection conn = getObjectConnection(); boolean modified = false; try { boolean autoCommit = conn.isAutoCommit(); if (autoCommit) conn.setAutoCommit(false); try { for (Object o : c) if (add(o)) modified = true; if (autoCommit) conn.setAutoCommit(true); } finally { if (autoCommit && !conn.isAutoCommit()) { conn.rollback(); conn.setAutoCommit(true); } } } catch (RepositoryException e) { throw new ObjectPersistException(e); } refresh(); refreshEntity(); return modified; }
public void setSingle(Object o) { if (o == null) { clear(); } else { ObjectConnection conn = getObjectConnection(); try { boolean autoCommit = conn.isAutoCommit(); if (autoCommit) conn.setAutoCommit(false); try { clear(); add(o); if (autoCommit) conn.setAutoCommit(true); } finally { if (autoCommit && !conn.isAutoCommit()) { conn.rollback(); conn.setAutoCommit(true); } } } catch (RepositoryException e) { throw new ObjectPersistException(e); } } }
public boolean addAll(Collection<?> c) { ObjectConnection conn = getObjectConnection(); boolean modified = false; try { boolean autoCommit = conn.isAutoCommit(); if (autoCommit) conn.setAutoCommit(false); try { for (Object o : c) if (add(o)) modified = true; if (autoCommit) conn.setAutoCommit(true); } finally { if (autoCommit && !conn.isAutoCommit()) { conn.rollback(); conn.setAutoCommit(true); } } } catch (RepositoryException e) { throw new ObjectPersistException(e); } refresh(); refreshEntity(); return modified; }
public void setSingle(Object o) { if (o == null) { clear(); } else { ObjectConnection conn = getObjectConnection(); try { boolean autoCommit = conn.isAutoCommit(); if (autoCommit) conn.setAutoCommit(false); try { clear(); add(o); if (autoCommit) conn.setAutoCommit(true); } finally { if (autoCommit && !conn.isAutoCommit()) { conn.rollback(); conn.setAutoCommit(true); } } } catch (RepositoryException e) { throw new ObjectPersistException(e); } } }