Java 类org.hibernate.procedure.ProcedureCall 实例源码

项目:high-performance-java-persistence    文件:PostgreSQLStoredProcedureTest.java   
@Test
public void testHibernateProcedureCallRefCursor() {
    doInJPA(entityManager -> {
        Session session = entityManager.unwrap(Session.class);
        ProcedureCall call = session
            .createStoredProcedureCall("post_comments");
        call.registerParameter(1, void.class, ParameterMode.REF_CURSOR);
        call.registerParameter(2, Long.class, ParameterMode.IN).bindValue(1L);

        Output output = call.getOutputs().getCurrent();
        if (output.isResultSet()) {
            List<Object[]> postComments = ((ResultSetOutput) output).getResultList();
            assertEquals(2, postComments.size());
        }
    });
}
项目:lams    文件:AbstractSessionImpl.java   
@Override
    @SuppressWarnings("UnnecessaryLocalVariable")
    public ProcedureCall getNamedProcedureCall(String name) {
        errorIfClosed();

        final ProcedureCallMemento memento = factory.getNamedQueryRepository().getNamedProcedureCallMemento( name );
        if ( memento == null ) {
            throw new IllegalArgumentException(
                    "Could not find named stored procedure call with that registration name : " + name
            );
        }
        final ProcedureCall procedureCall = memento.makeProcedureCall( this );
//      procedureCall.setComment( "Named stored procedure call [" + name + "]" );
        return procedureCall;
    }
项目:lams    文件:AbstractSessionImpl.java   
@Override
    @SuppressWarnings("UnnecessaryLocalVariable")
    public ProcedureCall createStoredProcedureCall(String procedureName) {
        errorIfClosed();
        final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName );
//      call.setComment( "Dynamic stored procedure call" );
        return procedureCall;
    }
项目:lams    文件:AbstractSessionImpl.java   
@Override
    @SuppressWarnings("UnnecessaryLocalVariable")
    public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses) {
        errorIfClosed();
        final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName, resultClasses );
//      call.setComment( "Dynamic stored procedure call" );
        return procedureCall;
    }
项目:lams    文件:AbstractSessionImpl.java   
@Override
    @SuppressWarnings("UnnecessaryLocalVariable")
    public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings) {
        errorIfClosed();
        final ProcedureCall procedureCall = new ProcedureCallImpl( this, procedureName, resultSetMappings );
//      call.setComment( "Dynamic stored procedure call" );
        return procedureCall;
    }
项目:high-performance-java-persistence    文件:MySQLStoredProcedureTest.java   
@Test
public void testHibernateProcedureCallOutParameter() {
    doInJPA(entityManager -> {
        Session session = entityManager.unwrap(Session.class);
        ProcedureCall call = session.createStoredProcedureCall("getStatistics");
        call.registerParameter("postId", Long.class, ParameterMode.IN).bindValue(1L);
        call.registerParameter("commentCount", Long.class, ParameterMode.OUT);

        Long commentCount = (Long) call.getOutputs().getOutputParameterValue("commentCount");
        assertEquals(Long.valueOf(2), commentCount);
    });
}
项目:high-performance-java-persistence    文件:MySQLStoredProcedureTest.java   
@Test
public void testHibernateProcedureCallReturnValueParameter() {
    doInJPA(entityManager -> {
        Session session = entityManager.unwrap(Session.class);
        ProcedureCall call = session.createStoredProcedureCall("post_comments");
        call.registerParameter(1, Long.class, ParameterMode.IN).bindValue(1L);

        Output output = call.getOutputs().getCurrent();
        if (output.isResultSet()) {
            List<Object[]> postComments = ((ResultSetOutput) output).getResultList();
            assertEquals(2, postComments.size());
        }
    });
}
项目:high-performance-java-persistence    文件:OracleStoredProcedureTest.java   
@Test
public void testHibernateProcedureCallRefCursor() {
    doInJPA(entityManager -> {
        Session session = entityManager.unwrap(Session.class);
        ProcedureCall call = session.createStoredProcedureCall("post_comments");
        call.registerParameter(1, Long.class, ParameterMode.IN).bindValue(1L);
        call.registerParameter(2, Class.class, ParameterMode.REF_CURSOR);

        Output output = call.getOutputs().getCurrent();
        if (output.isResultSet()) {
            List<Object[]> postComments = ((ResultSetOutput) output).getResultList();
            assertEquals(2, postComments.size());
        }
    });
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public ProcedureCall getNamedProcedureCall(String name) {
    return session.getNamedProcedureCall( name );
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName) {
    return session.createStoredProcedureCall( procedureName );
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses) {
    return session.createStoredProcedureCall( procedureName, resultClasses );
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings) {
    return session.createStoredProcedureCall( procedureName, resultSetMappings );
}
项目:lams    文件:SessionImpl.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName) {
    errorIfClosed();
    checkTransactionSynchStatus();
    return super.createStoredProcedureCall( procedureName );
}
项目:lams    文件:SessionImpl.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings) {
    errorIfClosed();
    checkTransactionSynchStatus();
    return super.createStoredProcedureCall( procedureName, resultSetMappings );
}
项目:lams    文件:SessionImpl.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses) {
    errorIfClosed();
    checkTransactionSynchStatus();
    return super.createStoredProcedureCall( procedureName, resultClasses );
}
项目:lams    文件:ProcedureCallImpl.java   
@Override
@SuppressWarnings("unchecked")
public ProcedureCall registerParameter0(int position, Class type, ParameterMode mode) {
    registerParameter( position, type, mode );
    return this;
}
项目:lams    文件:ProcedureCallImpl.java   
@Override
@SuppressWarnings("unchecked")
public ProcedureCall registerParameter0(String name, Class type, ParameterMode mode) {
    registerParameter( name, type, mode );
    return this;
}
项目:lams    文件:ProcedureCallMementoImpl.java   
@Override
public ProcedureCall makeProcedureCall(Session session) {
    return new ProcedureCallImpl( (SessionImplementor) session, this );
}
项目:lams    文件:ProcedureCallMementoImpl.java   
@Override
public ProcedureCall makeProcedureCall(SessionImplementor session) {
    return new ProcedureCallImpl( session, this );
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@Override
public ProcedureCall getNamedProcedureCall(String name) {
    return target.getNamedProcedureCall(name);
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName) {
    return target.createStoredProcedureCall(procedureName);
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName, @SuppressWarnings("rawtypes") Class... resultClasses) {
    return target.createStoredProcedureCall(procedureName, resultClasses);
}
项目:jadira    文件:AbstractProxySharedSessionContractImplementor.java   
@Override
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings) {
    return target.createStoredProcedureCall(procedureName, resultSetMappings);
}
项目:lams    文件:SharedSessionContract.java   
/**
 * Gets a ProcedureCall based on a named template
 *
 * @param name The name given to the template
 *
 * @return The ProcedureCall
 *
 * @see javax.persistence.NamedStoredProcedureQuery
 */
public ProcedureCall getNamedProcedureCall(String name);
项目:lams    文件:SharedSessionContract.java   
/**
 * Creates a call to a stored procedure.
 *
 * @param procedureName The name of the procedure.
 *
 * @return The representation of the procedure call.
 */
public ProcedureCall createStoredProcedureCall(String procedureName);
项目:lams    文件:SharedSessionContract.java   
/**
 * Creates a call to a stored procedure with specific result set entity mappings.  Each class named
 * is considered a "root return".
 *
 * @param procedureName The name of the procedure.
 * @param resultClasses The entity(s) to map the result on to.
 *
 * @return The representation of the procedure call.
 */
public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses);
项目:lams    文件:SharedSessionContract.java   
/**
 * Creates a call to a stored procedure with specific result set entity mappings.
 *
 * @param procedureName The name of the procedure.
 * @param resultSetMappings The explicit result set mapping(s) to use for mapping the results
 *
 * @return The representation of the procedure call.
 */
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings);