Tabnine Logo
SQLInsertClause.executeWithKeys
Code IndexAdd Tabnine to your IDE (free)

How to use
executeWithKeys
method
in
com.querydsl.sql.dml.SQLInsertClause

Best Java code snippets using com.querydsl.sql.dml.SQLInsertClause.executeWithKeys (Showing top 6 results out of 315)

origin: org.huiche/huiche-dao

if (size > 0) {
  if (createSetId()) {
    LinkedList<Long> ids = new LinkedList<>(insert.executeWithKeys(pk()));
    if (entityList.size() == ids.size()) {
      entityList.forEach(t -> t.setId(ids.poll()));
origin: com.querydsl/querydsl-sql

@Test
@ExcludeIn({CUBRID, SQLSERVER})
public void insert_with_keys() throws SQLException {
  ResultSet rs = insert(survey).set(survey.name, "Hello World").executeWithKeys();
  assertTrue(rs.next());
  assertTrue(rs.getObject(1) != null);
  rs.close();
}
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
@ExcludeIn({CUBRID, SQLSERVER})
public void insert_with_keys_listener() throws SQLException {
  final AtomicBoolean result = new AtomicBoolean();
  SQLListener listener = new SQLBaseListener() {
    @Override
    public void end(SQLListenerContext context) {
      result.set(true);
    }
  };
  SQLInsertClause clause = insert(survey).set(survey.name, "Hello World");
  clause.addListener(listener);
  ResultSet rs = clause.executeWithKeys();
  assertFalse(result.get());
  assertTrue(rs.next());
  assertTrue(rs.getObject(1) != null);
  rs.close();
  assertTrue(result.get());
}
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

insert.addListener(listeners);
populate(insert);
return insert.executeWithKeys();
com.querydsl.sql.dmlSQLInsertClauseexecuteWithKeys

Popular methods of SQLInsertClause

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

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
  • setScale (BigDecimal)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top plugins for Android Studio
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