Search in sources :

Example 1 with Request

use of org.datanucleus.store.rdbms.request.Request in project datanucleus-rdbms by datanucleus.

the class RDBMSPersistenceHandler method getInsertRequest.

/**
 * Returns a request object that will insert a row in the given table.
 * The store manager will cache the request object for re-use by subsequent requests to the same table.
 * @param table The table into which to insert.
 * @param cmd ClassMetaData of the object of the request
 * @param clr ClassLoader resolver
 * @return An insertion request object.
 */
private Request getInsertRequest(DatastoreClass table, AbstractClassMetaData cmd, ClassLoaderResolver clr) {
    RequestIdentifier reqID = new RequestIdentifier(table, null, RequestType.INSERT, cmd.getFullClassName());
    Request req = requestsByID.get(reqID);
    if (req == null) {
        req = new InsertRequest(table, cmd, clr);
        requestsByID.put(reqID, req);
    }
    return req;
}
Also used : InsertRequest(org.datanucleus.store.rdbms.request.InsertRequest) LocateRequest(org.datanucleus.store.rdbms.request.LocateRequest) Request(org.datanucleus.store.rdbms.request.Request) FetchRequest(org.datanucleus.store.rdbms.request.FetchRequest) DeleteRequest(org.datanucleus.store.rdbms.request.DeleteRequest) InsertRequest(org.datanucleus.store.rdbms.request.InsertRequest) LocateBulkRequest(org.datanucleus.store.rdbms.request.LocateBulkRequest) UpdateRequest(org.datanucleus.store.rdbms.request.UpdateRequest) RequestIdentifier(org.datanucleus.store.rdbms.request.RequestIdentifier)

Example 2 with Request

use of org.datanucleus.store.rdbms.request.Request in project datanucleus-rdbms by datanucleus.

the class RDBMSPersistenceHandler method getLocateRequest.

/**
 * Returns a request object that will locate a row from the given table.
 * The store manager will cache the request object for re-use by subsequent requests to the same table.
 * @param table The table from which to locate.
 * @param className the class name of the object of the request
 * @return A locate request object.
 */
private Request getLocateRequest(DatastoreClass table, String className) {
    RequestIdentifier reqID = new RequestIdentifier(table, null, RequestType.LOCATE, className);
    Request req = requestsByID.get(reqID);
    if (req == null) {
        req = new LocateRequest(table);
        requestsByID.put(reqID, req);
    }
    return req;
}
Also used : LocateRequest(org.datanucleus.store.rdbms.request.LocateRequest) Request(org.datanucleus.store.rdbms.request.Request) FetchRequest(org.datanucleus.store.rdbms.request.FetchRequest) DeleteRequest(org.datanucleus.store.rdbms.request.DeleteRequest) InsertRequest(org.datanucleus.store.rdbms.request.InsertRequest) LocateBulkRequest(org.datanucleus.store.rdbms.request.LocateBulkRequest) UpdateRequest(org.datanucleus.store.rdbms.request.UpdateRequest) RequestIdentifier(org.datanucleus.store.rdbms.request.RequestIdentifier) LocateRequest(org.datanucleus.store.rdbms.request.LocateRequest)

Example 3 with Request

use of org.datanucleus.store.rdbms.request.Request in project datanucleus-rdbms by datanucleus.

the class RDBMSPersistenceHandler method getUpdateRequest.

/**
 * Returns a request object that will update a row in the given table.
 * The store manager will cache the request object for re-use by subsequent requests to the same table.
 * @param table The table in which to update.
 * @param mmds The metadata corresponding to the columns to be updated.
 *     MetaData whose columns exist in supertables will be ignored.
 * @param cmd ClassMetaData of the object of the request
 * @param clr ClassLoader resolver
 * @return An update request object.
 */
private Request getUpdateRequest(DatastoreClass table, AbstractMemberMetaData[] mmds, AbstractClassMetaData cmd, ClassLoaderResolver clr) {
    RequestIdentifier reqID = new RequestIdentifier(table, mmds, RequestType.UPDATE, cmd.getFullClassName());
    Request req = requestsByID.get(reqID);
    if (req == null) {
        req = new UpdateRequest(table, mmds, cmd, clr);
        requestsByID.put(reqID, req);
    }
    return req;
}
Also used : UpdateRequest(org.datanucleus.store.rdbms.request.UpdateRequest) LocateRequest(org.datanucleus.store.rdbms.request.LocateRequest) Request(org.datanucleus.store.rdbms.request.Request) FetchRequest(org.datanucleus.store.rdbms.request.FetchRequest) DeleteRequest(org.datanucleus.store.rdbms.request.DeleteRequest) InsertRequest(org.datanucleus.store.rdbms.request.InsertRequest) LocateBulkRequest(org.datanucleus.store.rdbms.request.LocateBulkRequest) UpdateRequest(org.datanucleus.store.rdbms.request.UpdateRequest) RequestIdentifier(org.datanucleus.store.rdbms.request.RequestIdentifier)

Example 4 with Request

use of org.datanucleus.store.rdbms.request.Request in project datanucleus-rdbms by datanucleus.

the class RDBMSPersistenceHandler method getFetchRequest.

/**
 * Returns a request object that will fetch a row from the given table.
 * The store manager will cache the request object for re-use by subsequent requests to the same table.
 * @param table The table from which to fetch.
 * @param mmds MetaData for the members corresponding to the columns to be fetched.
 * @param cmd ClassMetaData of the object of the request
 * @param clr ClassLoader resolver
 * @return A fetch request object.
 */
private Request getFetchRequest(DatastoreClass table, AbstractMemberMetaData[] mmds, AbstractClassMetaData cmd, ClassLoaderResolver clr) {
    RequestIdentifier reqID = new RequestIdentifier(table, mmds, RequestType.FETCH, cmd.getFullClassName());
    Request req = requestsByID.get(reqID);
    if (req == null) {
        req = new FetchRequest(table, mmds, cmd, clr);
        requestsByID.put(reqID, req);
    }
    return req;
}
Also used : LocateRequest(org.datanucleus.store.rdbms.request.LocateRequest) Request(org.datanucleus.store.rdbms.request.Request) FetchRequest(org.datanucleus.store.rdbms.request.FetchRequest) DeleteRequest(org.datanucleus.store.rdbms.request.DeleteRequest) InsertRequest(org.datanucleus.store.rdbms.request.InsertRequest) LocateBulkRequest(org.datanucleus.store.rdbms.request.LocateBulkRequest) UpdateRequest(org.datanucleus.store.rdbms.request.UpdateRequest) FetchRequest(org.datanucleus.store.rdbms.request.FetchRequest) RequestIdentifier(org.datanucleus.store.rdbms.request.RequestIdentifier)

Example 5 with Request

use of org.datanucleus.store.rdbms.request.Request in project datanucleus-rdbms by datanucleus.

the class RDBMSPersistenceHandler method getDeleteRequest.

/**
 * Returns a request object that will delete a row from the given table.
 * The store manager will cache the request object for re-use by subsequent requests to the same table.
 * @param table The table from which to delete.
 * @param acmd ClassMetaData of the object of the request
 * @param clr ClassLoader resolver
 * @return A deletion request object.
 */
private Request getDeleteRequest(DatastoreClass table, AbstractClassMetaData acmd, ClassLoaderResolver clr) {
    RequestIdentifier reqID = new RequestIdentifier(table, null, RequestType.DELETE, acmd.getFullClassName());
    Request req = requestsByID.get(reqID);
    if (req == null) {
        req = new DeleteRequest(table, acmd, clr);
        requestsByID.put(reqID, req);
    }
    return req;
}
Also used : LocateRequest(org.datanucleus.store.rdbms.request.LocateRequest) Request(org.datanucleus.store.rdbms.request.Request) FetchRequest(org.datanucleus.store.rdbms.request.FetchRequest) DeleteRequest(org.datanucleus.store.rdbms.request.DeleteRequest) InsertRequest(org.datanucleus.store.rdbms.request.InsertRequest) LocateBulkRequest(org.datanucleus.store.rdbms.request.LocateBulkRequest) UpdateRequest(org.datanucleus.store.rdbms.request.UpdateRequest) DeleteRequest(org.datanucleus.store.rdbms.request.DeleteRequest) RequestIdentifier(org.datanucleus.store.rdbms.request.RequestIdentifier)

Aggregations

DeleteRequest (org.datanucleus.store.rdbms.request.DeleteRequest)6 FetchRequest (org.datanucleus.store.rdbms.request.FetchRequest)6 InsertRequest (org.datanucleus.store.rdbms.request.InsertRequest)6 LocateBulkRequest (org.datanucleus.store.rdbms.request.LocateBulkRequest)6 LocateRequest (org.datanucleus.store.rdbms.request.LocateRequest)6 Request (org.datanucleus.store.rdbms.request.Request)6 UpdateRequest (org.datanucleus.store.rdbms.request.UpdateRequest)6 RequestIdentifier (org.datanucleus.store.rdbms.request.RequestIdentifier)5 ArrayList (java.util.ArrayList)1 ClassLoaderResolver (org.datanucleus.ClassLoaderResolver)1 ExecutionContext (org.datanucleus.ExecutionContext)1 AbstractClassMetaData (org.datanucleus.metadata.AbstractClassMetaData)1 AbstractMemberMetaData (org.datanucleus.metadata.AbstractMemberMetaData)1 RelationType (org.datanucleus.metadata.RelationType)1 DatastoreClass (org.datanucleus.store.rdbms.table.DatastoreClass)1 SecondaryDatastoreClass (org.datanucleus.store.rdbms.table.SecondaryDatastoreClass)1