Esempio n. 1
0
 @Override
 public String[] submit(java.util.Collection<gen.model.test.Clicked> domainEvents) {
   java.sql.Connection connection = getConnection();
   try (java.sql.PreparedStatement statement =
           connection.prepareStatement(
               "/*NO LOAD BALANCE*/SELECT \"URI\" FROM \"test\".\"submit_Clicked\"(?)");
       org.revenj.postgres.PostgresWriter sw = org.revenj.postgres.PostgresWriter.create()) {
     if (prepareEvents != null) prepareEvents.accept(domainEvents);
     String[] result = new String[domainEvents.size()];
     org.revenj.postgres.converters.PostgresTuple tuple =
         org.revenj.postgres.converters.ArrayTuple.create(domainEvents, converter::to);
     org.postgresql.util.PGobject pgo = new org.postgresql.util.PGobject();
     pgo.setType("\"test\".\"Clicked_event\"[]");
     tuple.buildTuple(sw, false);
     pgo.setValue(sw.toString());
     statement.setObject(1, pgo);
     try (java.sql.ResultSet rs = statement.executeQuery()) {
       for (int i = 0; i < result.length; i++) {
         rs.next();
         result[i] = rs.getString(1);
       }
     }
     if (assignUris != null) assignUris.accept(domainEvents, result);
     return result;
   } catch (java.sql.SQLException e) {
     throw new RuntimeException(e);
   } finally {
     releaseConnection(connection);
   }
 }
Esempio n. 2
0
  public PostgresTuple toExtended(gen.model.test.Detail2 instance) {
    if (instance == null) return null;
    PostgresTuple[] items = new PostgresTuple[columnCountExtended];

    items[__index__extended_u] =
        org.revenj.postgres.converters.UrlConverter.toTuple(instance.getU());
    items[__index__extended_dd] =
        org.revenj.postgres.converters.ArrayTuple.create(
            instance.getDd(), org.revenj.postgres.converters.DoubleConverter::toTuple);
    items[__index__extended_EntityCompositeid] =
        org.revenj.postgres.converters.UuidConverter.toTuple(instance.getEntityCompositeid());
    items[__index__extended_EntityIndex] =
        org.revenj.postgres.converters.IntConverter.toTuple(instance.getEntityIndex());
    items[__index__extended_Index] =
        org.revenj.postgres.converters.IntConverter.toTuple(instance.getIndex());
    return RecordTuple.from(items);
  }