Package org.datanucleus.store

Examples of org.datanucleus.store.ExecutionContext$LifecycleListener


     */
    public int[] internalAdd(ObjectProvider ownerSM, ManagedConnection conn, boolean batched, Object element, boolean processNow,
                             AbstractSetStore setStore)
    throws MappedDatastoreException
    {
        ExecutionContext ec = ownerSM.getExecutionContext();
        SQLController sqlControl = storeMgr.getSQLController();
        String addStmt = getAddStmt(setStore);
        try
        {
            PreparedStatement ps = sqlControl.getStatementForUpdate(conn, addStmt, batched);
View Full Code Here


    }

    public boolean remove(ObjectProvider sm, Object element, int size, AbstractSetStore setStore)
    {
        boolean modified = false;
        ExecutionContext ec = sm.getExecutionContext();
        String removeStmt = getRemoveStmt(setStore);
        try
        {
            ManagedConnection mconn = storeMgr.getConnection(ec);
            SQLController sqlControl = storeMgr.getSQLController();
View Full Code Here

    }

    public int[] internalRemove(ObjectProvider ownerSM, ManagedConnection conn, boolean batched, Object element, boolean executeNow,
                                AbstractCollectionStore acs) throws MappedDatastoreException
    {
        ExecutionContext ec = ownerSM.getExecutionContext();
        SQLController sqlControl = storeMgr.getSQLController();
        String removeStmt = getRemoveStmt(acs);
        try
        {
            PreparedStatement ps = sqlControl.getStatementForUpdate(conn, removeStmt, batched);
View Full Code Here

     * @param endIdx The end index in the list (only for indexed lists)
     * @return The List Iterator
     */
    protected ListIterator listIterator(ObjectProvider ownerSM, int startIdx, int endIdx)
    {
        ExecutionContext ec = ownerSM.getExecutionContext();
        Transaction tx = ec.getTransaction();
        boolean useUpdateLock = tx.lockReadObjects();

        StatementClassMapping resultDefinition = null;
        StatementParameterMapping paramDefinition = null;
        String stmt = null;
View Full Code Here

     */
    @SuppressWarnings("deprecation")
    public static void updateClobColumn(ObjectProvider sm, DatastoreContainerObject datastoreContainer,
            DatastoreMapping mapping, String value)
    {
        ExecutionContext ec = sm.getExecutionContext();
        RDBMSStoreManager storeMgr = (RDBMSStoreManager)ec.getStoreManager();
        DatastoreClass classTable = (DatastoreClass)datastoreContainer; // Don't support join tables yet
        SQLExpressionFactory exprFactory = storeMgr.getSQLExpressionFactory();

        // Generate "SELECT {clobColumn} FROM TABLE WHERE ID=? FOR UPDATE" statement
        SQLStatement sqlStmt = new SQLStatement(storeMgr, datastoreContainer, null, null);
        sqlStmt.setClassLoaderResolver(ec.getClassLoaderResolver());
        sqlStmt.addExtension("lock-for-update", true);
        SQLTable blobSqlTbl = SQLStatementHelper.getSQLTableForMappingOfTable(sqlStmt, sqlStmt.getPrimaryTable(), mapping.getJavaTypeMapping());
        sqlStmt.select(blobSqlTbl, mapping.getDatastoreField(), null);
        StatementClassMapping mappingDefinition = new StatementClassMapping();
        AbstractClassMetaData cmd = sm.getClassMetaData();
View Full Code Here

     */
    @SuppressWarnings("deprecation")
    public static void updateBlobColumn(ObjectProvider sm, DatastoreContainerObject datastoreContainer,
            DatastoreMapping mapping, byte[] bytes)
    {
        ExecutionContext ec = sm.getExecutionContext();
        RDBMSStoreManager storeMgr = (RDBMSStoreManager)ec.getStoreManager();
        DatastoreClass classTable = (DatastoreClass)datastoreContainer; // Don't support join tables yet
        SQLExpressionFactory exprFactory = storeMgr.getSQLExpressionFactory();

        // Generate "SELECT {blobColumn} FROM TABLE WHERE ID=? FOR UPDATE" statement
        SQLStatement sqlStmt = new SQLStatement(storeMgr, datastoreContainer, null, null);
        sqlStmt.setClassLoaderResolver(ec.getClassLoaderResolver());
        sqlStmt.addExtension("lock-for-update", true);
        SQLTable blobSqlTbl = SQLStatementHelper.getSQLTableForMappingOfTable(sqlStmt, sqlStmt.getPrimaryTable(), mapping.getJavaTypeMapping());
        sqlStmt.select(blobSqlTbl, mapping.getDatastoreField(), null);
        StatementClassMapping mappingDefinition = new StatementClassMapping();
        AbstractClassMetaData cmd = sm.getClassMetaData();
View Full Code Here

            throw new UnsupportedOperationException("Cannot remove from a map through its values collection");
        }

        Object key = null;
        boolean keyExists = false;
        ExecutionContext ec = sm.getExecutionContext();

        try
        {
            RDBMSStoreManager rdbmsMgr = (RDBMSStoreManager)storeMgr;
            ManagedConnection mconn = rdbmsMgr.getConnection(ec);
View Full Code Here

     * @param ownerSM State Manager for the set.
     * @return Iterator for the set.
     **/
    public Iterator iterator(ObjectProvider ownerSM)
    {
        ExecutionContext ec = ownerSM.getExecutionContext();
        if (iteratorStmtLocked == null)
        {
            synchronized (this) // Make sure this completes in case another thread needs the same info
            {
                // Generate the statement, and statement mapping/parameter information
                SQLStatement sqlStmt = getSQLStatementForIterator(ownerSM);
                iteratorStmtUnlocked = sqlStmt.getSelectStatement().toSQL();
                sqlStmt.addExtension("lock-for-update", true);
                iteratorStmtLocked = sqlStmt.getSelectStatement().toSQL();
            }
        }

        Transaction tx = ec.getTransaction();
        String stmt = (tx.lockReadObjects() ? iteratorStmtLocked : iteratorStmtUnlocked);
        try
        {
            ManagedConnection mconn = storeMgr.getConnection(ec);
            SQLController sqlControl = ((RDBMSStoreManager)storeMgr).getSQLController();
View Full Code Here

     */
    public static PreparedStatement getPreparedStatementForQuery(ManagedConnection conn, String queryStmt,
            Query query)
    throws SQLException
    {
        ExecutionContext ec = query.getExecutionContext();

        // Apply any non-standard result set definition if required (either from the PMF, or via query extensions)
        String rsTypeString = RDBMSQueryUtils.getResultSetTypeForQuery(query);
        if (rsTypeString != null &&
            (!rsTypeString.equals("scroll-sensitive") && !rsTypeString.equals("forward-only") &&
             !rsTypeString.equals("scroll-insensitive")))
        {
            throw new NucleusUserException(LOCALISER.msg("052510"));
        }

        String rsConcurrencyString = RDBMSQueryUtils.getResultSetConcurrencyForQuery(query);
        if (rsConcurrencyString != null &&
            (!rsConcurrencyString.equals("read-only") && !rsConcurrencyString.equals("updateable")))
        {
            throw new NucleusUserException(LOCALISER.msg("052511"));
        }

        SQLController sqlControl = ((RDBMSStoreManager)ec.getStoreManager()).getSQLController();
        PreparedStatement ps = sqlControl.getStatementForQuery(conn, queryStmt, rsTypeString, rsConcurrencyString);

        return ps;
    }
View Full Code Here

        if (elements == null || elements.size() == 0)
        {
            return;
        }

        ExecutionContext ec = sm.getExecutionContext();
        Iterator iter = elements.iterator();
        int jdbcPosition = 1;
        while (iter.hasNext())
        {
            Object element = iter.next();
View Full Code Here

TOP

Related Classes of org.datanucleus.store.ExecutionContext$LifecycleListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.