Tabnine Logo
SQLInsertClause.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.querydsl.sql.dml.SQLInsertClause
constructor

Best Java code snippets using com.querydsl.sql.dml.SQLInsertClause.<init> (Showing top 18 results out of 315)

origin: com.querydsl/querydsl-sql

@Override
public final SQLInsertClause insert(RelationalPath<?> path) {
  return new SQLInsertClause(connection, configuration, path);
}
origin: org.everit.resource/org.everit.resource.ri

@Override
public long createResource() {
 return querydslSupport.execute((connection, configuration) -> {
  QResource qResource = QResource.resource;
  new SQLInsertClause(connection, configuration, qResource);
  return new SQLInsertClause(connection, configuration, qResource)
    .executeWithKey(qResource.resourceId);
 });
}
origin: org.everit.authentication/org.everit.authentication.oauth2.ri

private long insertProvider() {
 return querydslSupport.execute((connection, configuration) -> {
  QOAuth2Provider qoAuth2Provider = QOAuth2Provider.oAuth2Provider;
  return new SQLInsertClause(connection, configuration, qoAuth2Provider)
    .set(qoAuth2Provider.providerName, providerName)
    .executeWithKey(qoAuth2Provider.oauth2ProviderId);
 });
}
origin: org.everit.props/org.everit.props.ri

@Override
public void addProperty(final String key, final String value) {
 Objects.requireNonNull(key, "Null key is not supported!");
 Objects.requireNonNull(value, "Null values are not supported!");
 transactionPropagator.required(() -> querydslSupport.execute((connection, configuration) -> {
  QProperty prop = QProperty.property;
  return new SQLInsertClause(connection, configuration, prop)
    .set(prop.key, key)
    .set(prop.value, value)
    .execute();
 }));
}
origin: com.querydsl/querydsl-sql

protected SQLInsertClause insert(RelationalPath<?> e) {
  SQLInsertClause sqlInsertClause = new SQLInsertClause(connection, configuration, e);
  sqlInsertClause.addListener(new TestLoggingListener());
  return sqlInsertClause;
}
origin: com.querydsl/querydsl-sql

protected SQLInsertClause insert(RelationalPath<?> e, SQLQuery<?> sq) {
  SQLInsertClause sqlInsertClause = new SQLInsertClause(connection, configuration, e, sq);
  sqlInsertClause.addListener(new TestLoggingListener());
  return sqlInsertClause;
}
origin: org.everit.blobstore/org.everit.blobstore.jdbc

@Override
public BlobAccessor createBlob() {
 Connection connection = createDatabaseConnection();
 QBlobstoreBlob qBlob = QBlobstoreBlob.blobstoreBlob;
 Long blobId;
 try {
  blobId = new SQLInsertClause(connection, this.querydslConfiguration, qBlob)
    .set(qBlob.version, 0L).set(qBlob.blob, this.emptyBlobExpression)
    .executeWithKey(qBlob.blobId);
 } catch (RuntimeException | Error e) {
  closeCloseableDueToThrowable(connection, e);
  throw new RuntimeException(e);
 }
 return updateBlob(blobId, connection, false);
}
origin: org.everit.authentication/org.everit.authentication.oauth2.ri

private Long insertResourceMapping(final String uniqueUserId) {
 return querydslSupport.execute((connection, configuration) -> {
  long resourceId = resourceService.createResource();
  QOAuth2ResourceMapping qoAuth2ResourceMapping = QOAuth2ResourceMapping.oAuth2ResourceMapping;
  new SQLInsertClause(connection, configuration, qoAuth2ResourceMapping)
    .set(qoAuth2ResourceMapping.resourceId, resourceId)
    .set(qoAuth2ResourceMapping.oauth2ProviderId, providerId)
    .set(qoAuth2ResourceMapping.providerUniqueUserId, uniqueUserId)
    .execute();
  return resourceId;
 });
}
origin: com.querydsl/querydsl-sql

@Test
public void test() throws SQLException {
  stmt.execute("drop table if exists GENERATED_KEYS");
  stmt.execute("create table GENERATED_KEYS(" +
       "ID int AUTO_INCREMENT PRIMARY KEY, " +
       "NAME varchar(30))");
  QGeneratedKeysEntity entity = new QGeneratedKeysEntity("entity");
  SQLInsertClause insertClause = new SQLInsertClause(conn, new H2Templates(), entity);
  ResultSet rs = insertClause.set(entity.name, "Hello").executeWithKeys();
  ResultSetMetaData md = rs.getMetaData();
  System.out.println(md.getColumnName(1));
  assertTrue(rs.next());
  assertEquals(1, rs.getInt(1));
  assertFalse(rs.next());
  insertClause = new SQLInsertClause(conn, new H2Templates(), entity);
  rs = insertClause.set(entity.name, "World").executeWithKeys();
  assertTrue(rs.next());
  assertEquals(2, rs.getInt(1));
  assertFalse(rs.next());
}
origin: com.querydsl/querydsl-sql

@Test(expected = IllegalStateException.class)
public void noConnection() {
  QEmployee emp1 = new QEmployee("emp1");
  SQLInsertClause insert = new SQLInsertClause(null, SQLTemplates.DEFAULT, emp1);
  insert.set(emp1.id, 1);
  insert.execute();
}
origin: com.querydsl/querydsl-sql

@Test
public void getSQLWithPreservedColumnOrder() {
  com.querydsl.sql.domain.QEmployee emp1 = new com.querydsl.sql.domain.QEmployee("emp1");
  SQLInsertClause insert = new SQLInsertClause(null, SQLTemplates.DEFAULT, emp1);
  insert.populate(emp1);
  SQLBindings sql = insert.getSQL().get(0);
  assertEquals("The order of columns in generated sql should be predictable",
      "insert into EMPLOYEE (ID, FIRSTNAME, LASTNAME, SALARY, DATEFIELD, TIMEFIELD, SUPERIOR_ID)\n" +
      "values (EMPLOYEE.ID, EMPLOYEE.FIRSTNAME, EMPLOYEE.LASTNAME, EMPLOYEE.SALARY, EMPLOYEE.DATEFIELD, EMPLOYEE.TIMEFIELD, EMPLOYEE.SUPERIOR_ID)", sql.getSQL());
}
origin: com.querydsl/querydsl-sql

@Test
public void test() throws SQLException {
  stmt.execute("drop table GENERATED_KEYS if exists");
  stmt.execute("create table GENERATED_KEYS(" +
       "ID int AUTO_INCREMENT PRIMARY KEY, " +
       "NAME varchar(30))");
  QGeneratedKeysEntity entity = new QGeneratedKeysEntity("entity");
  SQLInsertClause insertClause = new SQLInsertClause(conn, new H2Templates(), entity);
  ResultSet rs = insertClause.set(entity.name, "Hello").executeWithKeys();
  ResultSetMetaData md = rs.getMetaData();
  System.out.println(md.getColumnName(1));
  assertTrue(rs.next());
  assertEquals(1, rs.getInt(1));
  assertFalse(rs.next());
  insertClause = new SQLInsertClause(conn, new H2Templates(), entity);
  rs = insertClause.set(entity.name, "World").executeWithKeys();
  assertTrue(rs.next());
  assertEquals(2, rs.getInt(1));
  assertFalse(rs.next());
  insertClause = new SQLInsertClause(conn, new H2Templates(), entity);
  assertEquals(3, insertClause.set(entity.name, "World").executeWithKey(entity.id).intValue());
  insertClause = new SQLInsertClause(conn, new H2Templates(), entity);
  assertEquals(Collections.singletonList(4), insertClause.set(entity.name, "World").executeWithKeys(entity.id));
}
origin: com.querydsl/querydsl-sql

@Test
public void getSQL() {
  QEmployee emp1 = new QEmployee("emp1");
  SQLInsertClause insert = new SQLInsertClause(null, SQLTemplates.DEFAULT, emp1);
  insert.set(emp1.id, 1);
  SQLBindings sql = insert.getSQL().get(0);
  assertEquals("insert into EMPLOYEE (ID)\nvalues (?)", sql.getSQL());
  assertEquals(ImmutableList.of(1), sql.getBindings());
}
origin: com.querydsl/querydsl-sql

@Test
public void insert() {
  SQLInsertClause insertClause = new SQLInsertClause(connection,SQLTemplates.DEFAULT,survey);
  insertClause.set(survey.id, 1);
  insertClause.set(survey.name, (String) null);
  assertEquals("insert into SURVEY (ID, NAME)\nvalues (?, ?)", insertClause.toString());
}
origin: com.querydsl/querydsl-sql

} else {
  SQLInsertClause insert = new SQLInsertClause(connection(), configuration, entity);
  insert.addListener(listeners);
  populate(insert);
origin: com.querydsl/querydsl-sql

@SuppressWarnings("unchecked")
protected long executeCompositeMerge() {
  if (hasRow()) {
    // update
    SQLUpdateClause update = new SQLUpdateClause(connection(), configuration, entity);
    populate(update);
    addListeners(update);
    addKeyConditions(update);
    return update.execute();
  } else {
    // insert
    SQLInsertClause insert = new SQLInsertClause(connection(), configuration, entity);
    addListeners(insert);
    populate(insert);
    return insert.execute();
  }
}
origin: com.querydsl/querydsl-sql

@Test
public void bulk() {
  QEmployee emp1 = new QEmployee("emp1");
  SQLInsertClause insert = new SQLInsertClause(null, SQLTemplates.DEFAULT, emp1);
  insert.set(emp1.id, 1);
  insert.addBatch();
  insert.set(emp1.id, 2);
  insert.addBatch();
  insert.addFlag(QueryFlag.Position.END, " on duplicate key ignore");
  insert.setBatchToBulk(true);
  assertEquals("insert into EMPLOYEE (ID)\n" +
      "values (?), (?) on duplicate key ignore", insert.getSQL().get(0).getSQL());
}
origin: com.querydsl/querydsl-sql

@Test
public void clear() {
  QEmployee emp1 = new QEmployee("emp1");
  SQLInsertClause insert = new SQLInsertClause(null, SQLTemplates.DEFAULT, emp1);
  insert.set(emp1.id, 1);
  insert.addBatch();
  assertEquals(1, insert.getBatchCount());
  insert.clear();
  assertEquals(0, insert.getBatchCount());
}
com.querydsl.sql.dmlSQLInsertClause<init>

Popular methods of SQLInsertClause

  • execute
  • executeWithKey
  • set
  • addBatch
  • columns
  • executeWithKeys
  • addFlag
  • addListener
  • clear
  • getBatchCount
  • populate
  • values
  • populate,
  • values,
  • getSQL,
  • select,
  • setBatchToBulk,
  • setNull,
  • toString

Popular in Java

  • Finding current android device location
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now