Example usage for javax.resource.cci IndexedRecord iterator

List of usage examples for javax.resource.cci IndexedRecord iterator

Introduction

In this page you can find the example usage for javax.resource.cci IndexedRecord iterator.

Prototype

Iterator<E> iterator();

Source Link

Document

Returns an iterator over the elements in this list in proper sequence.

Usage

From source file:org.springframework.samples.jca.dao.PersonDaoImpl.java

/**
 * @see org.springframework.samples.jca.dao.PersonDao#updatePerson(org.springframework.samples.jca.model.Person)
 *//*from   w  ww.  j a v a 2  s  .c  o  m*/
public void updatePerson(final Person person) {
    StringBuffer request = new StringBuffer();
    request.append("update person set ");
    request.append("person_last_name=?,");
    request.append("person_first_name=?");
    request.append(" where person_id=?");
    CciInteractionSpec interactionSpec = new CciInteractionSpec();
    interactionSpec.setSql(request.toString());

    getCciTemplate().execute(interactionSpec, new RecordCreator() {
        public Record createRecord(RecordFactory recordFactory) throws ResourceException, DataAccessException {
            IndexedRecord input = recordFactory.createIndexedRecord("input");
            input.add(person.getLastName());
            input.add(person.getFirstName());
            input.add(new Integer(person.getId()));
            return input;
        }
    }, new RecordExtractor() {
        public Object extractData(Record record) throws ResourceException, SQLException, DataAccessException {
            IndexedRecord output = (IndexedRecord) record;
            for (Iterator i = output.iterator(); i.hasNext();) {
                log.debug("Number of updated lines : " + i.next());
            }
            return null;
        }
    });

}