Example usage for org.springframework.jca.cci.core RecordCreator createRecord

List of usage examples for org.springframework.jca.cci.core RecordCreator createRecord

Introduction

In this page you can find the example usage for org.springframework.jca.cci.core RecordCreator createRecord.

Prototype

Record createRecord(RecordFactory recordFactory) throws ResourceException, DataAccessException;

Source Link

Document

Create a CCI Record instance, usually based on the passed-in CCI RecordFactory.

Usage

From source file:org.springframework.jca.cci.core.CciTemplate.java

/**
 * Invoke the given RecordCreator, converting JCA ResourceExceptions
 * to Spring's DataAccessException hierarchy.
 * @param recordCreator the RecordCreator to invoke
 * @return the created Record/*ww  w .  ja  va  2s . co m*/
 * @throws DataAccessException if creation of the Record failed
 * @see #getRecordFactory(javax.resource.cci.ConnectionFactory)
 * @see RecordCreator#createRecord(javax.resource.cci.RecordFactory)
 */
protected Record createRecord(RecordCreator recordCreator) throws DataAccessException {
    try {
        RecordFactory recordFactory = getRecordFactory(obtainConnectionFactory());
        return recordCreator.createRecord(recordFactory);
    } catch (NotSupportedException ex) {
        throw new RecordTypeNotSupportedException(
                "Creation of the desired Record type not supported by connector", ex);
    } catch (ResourceException ex) {
        throw new CannotCreateRecordException("Creation of the desired Record failed", ex);
    }
}