Example usage for javax.persistence ParameterMode IN

List of usage examples for javax.persistence ParameterMode IN

Introduction

In this page you can find the example usage for javax.persistence ParameterMode IN.

Prototype

ParameterMode IN

To view the source code for javax.persistence ParameterMode IN.

Click Source Link

Document

Stored procedure input parameter

Usage

From source file:tools.xor.logic.DefaultStoredProcedure.java

private StoredProcedure getReadSP() {
    StoredProcedure sp = new StoredProcedure();
    sp.setName("basicInfoRead");
    sp.setAction(AggregateAction.READ);/*from  w w w .  j a  va  2  s  .c o  m*/

    ParameterMapping pm = new ParameterMapping();
    pm.setAttribute("id");
    pm.setMode(ParameterMode.IN);

    List<ParameterMapping> pmList = new ArrayList<ParameterMapping>();
    pmList.add(pm);
    sp.setParameterList(pmList);

    return sp;
}

From source file:example.springdata.jpa.storedprocedures.UserRepositoryIntegrationTests.java

@Test
public void plainJpa21() {

    StoredProcedureQuery proc = em.createStoredProcedureQuery("plus1inout");
    proc.registerStoredProcedureParameter(1, Integer.class, ParameterMode.IN);
    proc.registerStoredProcedureParameter(2, Integer.class, ParameterMode.OUT);

    proc.setParameter(1, 1);//from  w ww. j  av  a  2 s.co  m
    proc.execute();

    assertThat(proc.getOutputParameterValue(2), is((Object) 2));
}

From source file:tools.xor.logic.DefaultStoredProcedure.java

private StoredProcedure getCreateSP() {
    StoredProcedure sp = new StoredProcedure();
    sp.setName("basicInfoCreate");
    sp.setAction(AggregateAction.CREATE);

    // id/*w  w w .j  a va2  s . co m*/
    ParameterMapping pm = new ParameterMapping();
    pm.setAttribute("id");
    pm.setMode(ParameterMode.OUT);

    List<ParameterMapping> pmList = new ArrayList<ParameterMapping>();
    pmList.add(pm);
    sp.setParameterList(pmList);

    // name
    pm = new ParameterMapping();
    pm.setAttribute("name");
    pmList.add(pm);

    // displayName
    pm = new ParameterMapping();
    pm.setAttribute("displayName");
    pmList.add(pm);

    // description
    pm = new ParameterMapping();
    pm.setAttribute("description");
    pmList.add(pm);

    // iconUrl
    pm = new ParameterMapping();
    pm.setAttribute("iconUrl");
    pmList.add(pm);

    // detailedDescription
    pm = new ParameterMapping();
    pm.setAttribute("detailedDescription");
    pmList.add(pm);

    // extra1
    pm = new ParameterMapping();
    pm.setName("extra1");
    pm.setType(String.class);
    pm.setDefaultValue("ABC");
    pm.setMode(ParameterMode.IN);
    pmList.add(pm);

    // extra2
    pm = new ParameterMapping();
    pm.setName("extra2");
    pm.setType(Date.class);
    pm.setDefaultValue("2013-10-21T13:28:06.419Z");
    pm.setMode(ParameterMode.OUT);
    pmList.add(pm);

    // extra2
    pm = new ParameterMapping();
    pm.setName("extra3");
    pm.setType(void.class);
    pm.setMode(ParameterMode.OUT);
    pmList.add(pm);

    return sp;
}