979a1fd17b
across the package. Moved marshaller creation and management into the PersistenceContext because marshallers should be shared across a persistence context. Also moved the actual "get a connection and do the query" code into the persistence context which is sort of a nice separation. The repository and friends now just put together Query and Modifier objects and pass them to the context for execution. The context will eventually handle interaction with the cache as well (exposing manual manipulation mechanisms as needed to the DepotRepository).
52 lines
1.3 KiB
Java
52 lines
1.3 KiB
Java
//
|
|
// $Id$
|
|
//
|
|
// samskivert library - useful routines for java programs
|
|
// Copyright (C) 2006 Michael Bayne
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it
|
|
// under the terms of the GNU Lesser General Public License as published
|
|
// by the Free Software Foundation; either version 2.1 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this library; if not, write to the Free Software
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
package com.samskivert.jdbc.depot;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.SQLException;
|
|
|
|
/**
|
|
* Encapsulates a modification of persistent objects.
|
|
*/
|
|
public abstract class Modifier
|
|
{
|
|
public Key getKey ()
|
|
{
|
|
return _key;
|
|
}
|
|
|
|
public abstract int invoke (Connection conn) throws SQLException;
|
|
|
|
protected Modifier (Key key)
|
|
{
|
|
_key = key;
|
|
}
|
|
|
|
protected void updateKey (Key key)
|
|
{
|
|
if (key != null) {
|
|
_key = key;
|
|
}
|
|
}
|
|
|
|
protected Key _key;
|
|
}
|