Java Code Examples for org.jdbi.v3.sqlobject.statement.GetGeneratedKeys

The following examples show how to use org.jdbi.v3.sqlobject.statement.GetGeneratedKeys. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: irontest   Source File: EndpointDAO.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Duplicate the endpoint of the specified test step if the endpoint exists and is an unmanaged one.
 * @param oldTeststepId
 * @return new endpoint id if one endpoint is duplicated; null otherwise.
 */
@SqlUpdate("insert into endpoint (name, type, description, url, username, password, other_properties) " +
        "select e.name, e.type, e.description, e.url, e.username, e.password, e.other_properties " +
        "from teststep t left outer join endpoint e on t.endpoint_id = e.id where t.id = :oldTeststepId " +
        "and e.id is not null and e.environment_id is null")
@GetGeneratedKeys
Long duplicateUnmanagedEndpoint(@Bind("oldTeststepId") long oldTeststepId);
 
Example 2
Source Project: irontest   Source File: TeststepDAO.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This method considers test step insertion from both Create (test step) button on UI and test case duplicating.
 * @param teststep
 * @param request
 * @param endpointId
 * @return
 */
@SqlUpdate("insert into teststep (testcase_id, sequence, type, request, api_request, endpoint_id, " +
        "other_properties) values (:t.testcaseId, " +
          "(select coalesce(max(sequence), 0) + 1 from teststep where testcase_id = :t.testcaseId), " +
        ":t.type, :request, :apiRequest, :endpointId, :t.otherProperties)")
@GetGeneratedKeys
long _insertWithoutName(@BindBean("t") Teststep teststep, @Bind("request") Object request,
                        @Bind("endpointId") Long endpointId, @Bind("apiRequest") String apiRequest);
 
Example 3
Source Project: irontest   Source File: TeststepDAO.java    License: Apache License 2.0 5 votes vote down vote up
@SqlUpdate("insert into teststep (testcase_id, sequence, name, type, description, action, request, request_type, " +
        "request_filename, api_request, endpoint_id, endpoint_property, other_properties) values (:t.testcaseId, " +
        "select coalesce(max(sequence), 0) + 1 from teststep where testcase_id = :t.testcaseId, :t.name, " +
        ":t.type, :t.description, :t.action, :request, :requestType, :t.requestFilename, :apiRequest, " +
        ":endpointId, :t.endpointProperty, :t.otherProperties)")
@GetGeneratedKeys
long _insertWithName(@BindBean("t") Teststep teststep, @Bind("request") byte[] request,
                     @Bind("requestType") String requestType, @Bind("apiRequest") String apiRequest,
                     @Bind("endpointId") Long endpointId);
 
Example 4
Source Project: irontest   Source File: TestcaseRunDAO.java    License: Apache License 2.0 5 votes vote down vote up
@SqlUpdate("insert into testcase_run " +
        "(testcase_id, testcase_name, testcase_folderpath, starttime, duration, result) values " +
        "(:testcase_id, :testcase_name, :testcase_folderpath, :starttime, :duration, :result)")
@GetGeneratedKeys
long _insert(@Bind("testcase_id") long testcaseId, @Bind("testcase_name") String testcaseName,
             @Bind("testcase_folderpath") String testcaseFolderPath,
             @Bind("starttime") Date startTime, @Bind("duration") long duration,
             @Bind("result") String result);
 
Example 5
Source Project: irontest   Source File: TeststepRunDAO.java    License: Apache License 2.0 5 votes vote down vote up
@SqlUpdate("insert into teststep_run (testcase_run_id, testcase_individualrun_id, teststep, response, info_message," +
        " error_message, assertion_verifications, starttime, duration, result) values (" +
        ":testcaseRunId, :testcaseIndividualRunId, :teststep, :response, :infoMessage, :errorMessage, " +
        ":assertionVerifications, :startTime, :duration, :result)")
@GetGeneratedKeys
long _insert(@Bind("testcaseRunId") long testcaseRunId,
             @Bind("testcaseIndividualRunId") Long testcaseIndividualRunId,
             @Bind("teststep") String teststep, @Bind("response") String response,
             @Bind("infoMessage") String infoMessage, @Bind("errorMessage") String errorMessage,
             @Bind("assertionVerifications") String assertionVerifications,
             @Bind("startTime") Date startTime, @Bind("duration") long duration,
             @Bind("result") String result);
 
Example 6
Source Project: irontest   Source File: EndpointDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into endpoint (environment_id, type, other_properties) values (:evId, :ep.type, :ep.otherProperties)")
@GetGeneratedKeys
long _insertManagedEndpoint(@BindBean("ep") Endpoint endpoint, @Bind("evId") long environmentId);
 
Example 7
Source Project: irontest   Source File: FolderDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into folder (parent_folder_id) values (:parentFolderId)")
@GetGeneratedKeys
long _insert(@Bind("parentFolderId") long parentFolderId);
 
Example 8
Source Project: irontest   Source File: UserDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into user (username, password, salt) values (:username, :password, :salt)")
@GetGeneratedKeys
long _insert(@Bind("username") String username, @Bind("password") String password,
             @Bind("salt") String salt);
 
Example 9
Source Project: irontest   Source File: EnvironmentDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into environment values ()")
@GetGeneratedKeys
long _insert();
 
Example 10
Source Project: irontest   Source File: TestcaseIndividualRunDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into testcase_individualrun (testcase_run_id, caption, starttime, duration, result) values (" +
        ":testcaseRunId, :caption, :startTime, :duration, :result)")
@GetGeneratedKeys
long _insert(@Bind("testcaseRunId") long testcaseRunId, @Bind("caption") String caption,
             @Bind("startTime") Date startTime, @Bind("duration") long duration,
             @Bind("result") String result);
 
Example 11
Source Project: irontest   Source File: AssertionDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into assertion (teststep_id, name, type, other_properties) values " +
        "(:a.teststepId, :a.name, :a.type, :a.otherProperties)")
@GetGeneratedKeys
long insert(@BindBean("a") Assertion assertion);
 
Example 12
Source Project: irontest   Source File: TeststepDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into teststep (testcase_id, sequence, name, type, description, action, request, request_type, " +
        "request_filename, api_request, endpoint_id, endpoint_property, other_properties) select :newTestcaseId, " +
        "sequence, name, type, description, action, request, request_type, request_filename, api_request, " +
        "endpoint_id, endpoint_property, other_properties from teststep where id = :oldTeststepId")
@GetGeneratedKeys
long duplicateById(@Bind("oldTeststepId") long oldTeststepId, @Bind("newTestcaseId") long newTestcaseId);
 
Example 13
Source Project: irontest   Source File: DataTableColumnDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into datatable_column (name, type, sequence, testcase_id) values (:name, :type, " +
        "select coalesce(max(sequence), 0) + 1 from datatable_column where testcase_id = :testcaseId, :testcaseId)")
@GetGeneratedKeys
long insert(@Bind("testcaseId") long testcaseId, @Bind("name") String name, @Bind("type") String type);
 
Example 14
Source Project: irontest   Source File: DataTableColumnDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into datatable_column (type, sequence, testcase_id) values (:type, " +
        "select max(sequence) + 1 from datatable_column where testcase_id = :testcaseId, :testcaseId)")
@GetGeneratedKeys
long _insert(@Bind("testcaseId") long testcaseId, @Bind("type") String type);
 
Example 15
Source Project: irontest   Source File: TestcaseDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into testcase (description, parent_folder_id) values (:description, :parentFolderId)")
@GetGeneratedKeys
long _insertWithoutName(@BindBean Testcase testcase);
 
Example 16
Source Project: irontest   Source File: TestcaseDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into testcase (name, description, parent_folder_id, check_http_stubs_hit_order) values (" +
        ":name, :description, :parentFolderId, :checkHTTPStubsHitOrder)")
@GetGeneratedKeys
long _insertWithName(@BindBean Testcase testcase);
 
Example 17
Source Project: irontest   Source File: TestcaseDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into testcase (name, description, parent_folder_id, check_http_stubs_hit_order) " +
        "select :name, description, :parentFolderId, check_http_stubs_hit_order from testcase where id = :sourceTestcaseId")
@GetGeneratedKeys
long duplicateById(@Bind("name") String name, @Bind("parentFolderId") long parentFolderId,
                   @Bind("sourceTestcaseId") long sourceTestcaseId);
 
Example 18
Source Project: irontest   Source File: ArticleDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into article (title, content) values (:title, :content)")
@GetGeneratedKeys
long insert(@BindBean Article article);
 
Example 19
Source Project: irontest   Source File: UserDefinedPropertyDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into udp (testcase_id, sequence) values (:testcaseId, (" +
        "select coalesce(max(sequence), 0) + 1 from udp where testcase_id = :testcaseId))")
@GetGeneratedKeys
long _insertWithoutName(@Bind("testcaseId") long testcaseId);
 
Example 20
Source Project: irontest   Source File: UserDefinedPropertyDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into udp (testcase_id, sequence, name, value) values (:testcaseId, (" +
        "select coalesce(max(sequence), 0) + 1 from udp where testcase_id = :testcaseId), :name, :value)")
@GetGeneratedKeys
long _insertWithName(@Bind("testcaseId") long testcaseId, @Bind("name") String name, @Bind("value") String value);
 
Example 21
Source Project: irontest   Source File: HTTPStubMappingDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into httpstubmapping (testcase_id, number) values (:testcaseId, (" +
        "select coalesce(max(number), 0) + 1 from httpstubmapping where testcase_id = :testcaseId))")
@GetGeneratedKeys
long insert(@Bind("testcaseId") long testcaseId);
 
Example 22
Source Project: irontest   Source File: PropertyExtractorDAO.java    License: Apache License 2.0 4 votes vote down vote up
@SqlUpdate("insert into property_extractor (teststep_id, property_name, type, other_properties) values " +
        "(:teststepId, :p.propertyName, :p.type, :p.otherProperties)")
@GetGeneratedKeys
long insert(@Bind("teststepId") long teststepId, @BindBean("p") PropertyExtractor propertyExtractor);
 
Example 23
Source Project: jdit   Source File: PlayerSqlObject.java    License: MIT License 4 votes vote down vote up
@GetGeneratedKeys
@SqlUpdate("insert into players(first_name, last_name, birth_date, weight, height) values" +
        "(:first_name, :last_name, :birth_date, :weight, :height)")
Long createPlayer(@Bind("first_name") String firstName, @Bind("last_name") String lastName,
                  @Bind("birth_date") Date birthDate, @Bind("height") int height,
                  @Bind("weight") int weight);
 
Example 24
Source Project: jdit   Source File: PlayerSqlObject.java    License: MIT License 4 votes vote down vote up
@GetGeneratedKeys
@SqlUpdate("insert into players(first_name, last_name, birth_date, weight, height) values" +
        "(:first_name, :last_name, :birth_date, :weight, :height)")
Long createPlayer(@PlayerBinder Player player);
 
Example 25
Source Project: jdit   Source File: TeamSqlObject.java    License: MIT License 4 votes vote down vote up
@SqlUpdate("insert into teams(name, division) values (:name, :division)")
@GetGeneratedKeys
long createTeam(@Bind("name") String name, @Bind("division") Division division);
 
Example 26
Source Project: tutorials   Source File: CarModelDao.java    License: MIT License 4 votes vote down vote up
@SqlUpdate("insert")
@GetGeneratedKeys
Long insert(@BindBean CarModel carModel);
 
Example 27
Source Project: tutorials   Source File: CarModelDao.java    License: MIT License 4 votes vote down vote up
@SqlBatch("insert")
@GetGeneratedKeys
List<Long> bulkInsert(@BindBean List<CarModel> models);
 
Example 28
Source Project: tutorials   Source File: CarMakerDao.java    License: MIT License 4 votes vote down vote up
@SqlUpdate
@GetGeneratedKeys
Long insert(@BindBean CarMaker carMaker);
 
Example 29
Source Project: tutorials   Source File: CarMakerDao.java    License: MIT License 4 votes vote down vote up
@SqlBatch("insert")
@GetGeneratedKeys
List<Long> bulkInsert(@BindBean List<CarMaker> carMakers);
 
Example 30
Source Project: irontest   Source File: EndpointDAO.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Here assuming endpoint.password is already encrypted.
 * @param endpoint
 * @return
 */
@SqlUpdate("insert into endpoint (name, type, description, url, username, password, other_properties) " +
           "values (:ep.name, :ep.type, :ep.description, :ep.url, :ep.username, :ep.password, :ep.otherProperties)")
@GetGeneratedKeys
long insertUnmanagedEndpoint(@BindBean("ep") Endpoint endpoint);