1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package javax.sql; 19 20 import java.sql.SQLException; 21 22 /** 23 * An interface which provides functionality for a disconnected {@code RowSet} 24 * to put data updates back to the data source from which the {@code RowSet} was 25 * originally populated. An object implementing this interface is called a 26 * writer. 27 * <p> 28 * The writer must establish a connection to the {@code RowSet}'s database 29 * before writing the data. The {@code RowSet} calling this interface must 30 * implement the {@code RowSetInternal} interface. 31 * <p> 32 * The writer may encounter a situation where the updated data needs to be 33 * written back to the database, but has already been updated there in the mean 34 * time. How a conflict of this kind is handled is determined by the 35 * implementation of this writer. 36 * 37 * @see RowSetInternal 38 */ 39 public interface RowSetWriter { 40 41 /** 42 * Writes changes made in the {@code RowSet}, which is associated with this 43 * {@code RowSetWriter}, back to the database. 44 * 45 * @param theRowSet 46 * a row set that fulfills the following criteria: 47 * <ul> 48 * <li>it must implement the {@code RowSetInternal} interface,</li> 49 * <li>have this {@code RowSetWriter} registered with it,</li> 50 * <li>must call this method internally.</li> 51 * </ul> 52 * @return {@code true} if the modified data was written, {@code false} 53 * otherwise (which typically implies some form of conflict). 54 * @throws SQLException 55 * if a problem occurs accessing the database. 56 */ 57 public boolean writeData(RowSetInternal theRowSet) throws SQLException; 58 } 59