javax.transaction.Transactional.TxType Java Examples
The following examples show how to use
javax.transaction.Transactional.TxType.
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 File: IntegrationQueryServiceImpl.java From we-cmdb with Apache License 2.0 | 6 votes |
@Transactional(TxType.REQUIRES_NEW) @Override public List<IntQueryOperateAggResponseDto> operateAggregationQuery(int ciTypeId, List<IntQueryOperateAggRequetDto> aggRequests) { if (logger.isDebugEnabled()) { logger.debug("operateAggregationQuery with ciTypeId:{}, aggRequests: {}", ciTypeId, JsonUtil.toJson(aggRequests)); } List<IntQueryOperateAggResponseDto> responseDtos = new ArrayList<>(aggRequests.size()); aggRequests.forEach(x -> { IntQueryAggOperation operation = IntQueryAggOperation.fromCode(x.getOperation()); if (IntQueryAggOperation.None.equals(operation)) { throw new InvalidArgumentException(String.format("Wrong operation [%s] for integration aggreation query request.", x.getOperation())); } responseDtos.add(operateAggregationQueryUnit(ciTypeId, x, operation)); }); if (logger.isDebugEnabled()) { logger.debug("operateAggregationQuery response: {}", JsonUtil.toJson(responseDtos)); } return responseDtos; }
Example #2
Source File: MutinyTransactionalBean.java From quarkus with Apache License 2.0 | 5 votes |
@Transactional(value = TxType.REQUIRES_NEW) public void doInTx() { Assertions.assertEquals(0, Person.count()); Person entity = new Person(); entity.name = "Stef"; entity.persist(); }
Example #3
Source File: MutinyTransactionalBean.java From quarkus with Apache License 2.0 | 5 votes |
@Transactional(value = TxType.REQUIRES_NEW) public Uni<String> doInTxUni() { Assertions.assertEquals(0, Person.count()); Person entity = new Person(); entity.name = "Stef"; entity.persist(); return Uni.createFrom().item("OK"); }
Example #4
Source File: MutinyTransactionalBean.java From quarkus with Apache License 2.0 | 5 votes |
@Transactional(value = TxType.REQUIRES_NEW) public Multi<String> doInTxMulti() { Assertions.assertEquals(0, Person.count()); Person entity = new Person(); entity.name = "Stef"; entity.persist(); return Multi.createFrom().items("OK"); }
Example #5
Source File: TransactionalBean.java From quarkus with Apache License 2.0 | 5 votes |
@Transactional(value = TxType.REQUIRES_NEW) public void doInTx() { Assertions.assertEquals(0, ContextEntity.count()); ContextEntity entity = new ContextEntity(); entity.name = "Stef"; entity.persist(); }
Example #6
Source File: TransactionalBean.java From quarkus with Apache License 2.0 | 5 votes |
@Transactional(value = TxType.REQUIRES_NEW) public Single<String> doInTxSingle() { Assertions.assertEquals(0, ContextEntity.count()); ContextEntity entity = new ContextEntity(); entity.name = "Stef"; entity.persist(); return Single.just("OK"); }
Example #7
Source File: TransactionalBean.java From quarkus with Apache License 2.0 | 5 votes |
@Transactional(value = TxType.REQUIRES_NEW) public Flowable<String> doInTxPublisher() { Assertions.assertEquals(0, ContextEntity.count()); ContextEntity entity = new ContextEntity(); entity.name = "Stef"; entity.persist(); return Flowable.fromArray("OK"); }
Example #8
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 5 votes |
@Override @Transactional(TxType.REQUIRED) public <T> T required(Supplier<T> callback) { return callback.get(); }
Example #9
Source File: ClientResource.java From hibernate-demos with Apache License 2.0 | 5 votes |
@POST @Path("/client/reindex") @Transactional(TxType.NEVER) public void reindex() throws InterruptedException { Search.mapping( entityManagerFactory ) .scope( Client.class ) .massIndexer() .startAndWait(); }
Example #10
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.MANDATORY) public void mandatory(Runnable callback) { callback.run(); }
Example #11
Source File: TransactionalTestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.REQUIRES_NEW) public void doThrowing() { doOk(); throw new IllegalStateException(); }
Example #12
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.SUPPORTS) public void supports(Runnable callback) { callback.run(); }
Example #13
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.NOT_SUPPORTED) public void notSupported(Runnable callback) { callback.run(); }
Example #14
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.NEVER) public void never(Runnable callback) { callback.run(); }
Example #15
Source File: ClientResource.java From hibernate-demos with Apache License 2.0 | 4 votes |
@Transactional(TxType.NEVER) void reindexOnStart(@Observes StartupEvent event) throws InterruptedException { if ( "dev".equals( ProfileManager.getActiveProfile() ) ) { reindex(); } }
Example #16
Source File: TransactionalTestService.java From hibernate-demos with Apache License 2.0 | 4 votes |
@Transactional(value=TxType.MANDATORY) public String doSomething() { return "Success"; }
Example #17
Source File: IntegrationQueryServiceImpl.java From we-cmdb with Apache License 2.0 | 4 votes |
@Transactional(TxType.REQUIRES_NEW) @Override public int createIntegrationQuery(int ciTypeId, String queryName, IntegrationQueryDto intQueryDto) { if (logger.isDebugEnabled()) { logger.debug("Creating integrate query for ciTypeId [{}] queryName:{} intQueryDto:{}", ciTypeId, queryName, JsonUtil.toJsonString(intQueryDto)); } intQueryDto.validate(); List<AdmIntegrateTemplate> intQuerys = intTempRepository.findAllByName(queryName); if(intQuerys != null && intQuerys.size()>0){ throw new InvalidArgumentException(String.format("The given integration name (%s) is existed.",queryName)); } AdmIntegrateTemplate intTemplate = new AdmIntegrateTemplate(); intTemplate.setName(queryName); intTemplate.setDes(queryName); intTemplate.setCiTypeId(ciTypeId); intTemplate = buildIntegrateTempl(intQueryDto, intTemplate, null, null); // validate selection if (intTemplate.getAdmIntegrateTemplateAlias().size() == 0) { throw new InvalidArgumentException("Please select at leaset one CI."); } AtomicInteger attrCount = new AtomicInteger(0); intTemplate.getAdmIntegrateTemplateAlias().forEach(x -> { attrCount.addAndGet(x.getAdmIntegrateTemplateAliasAttrs().size()); }); if (attrCount.get() == 0) { throw new InvalidArgumentException("Please select at least one attribute."); } intTempRepository.save(intTemplate); intTemplAliasRepository.saveAll(intTemplate.getAdmIntegrateTemplateAlias()); intTemplate.getAdmIntegrateTemplateAlias().forEach(x -> { intTemplAliasAttrRepository.saveAll(x.getAdmIntegrateTemplateAliasAttrs()); intTemplRltRepository.saveAll(x.getChildIntegrateTemplateRelations()); }); logger.info("Created integrate template:{}", intTemplate.getIdAdmIntegrateTemplate()); return intTemplate.getIdAdmIntegrateTemplate(); }
Example #18
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.REQUIRES_NEW) public void requiresNew(Runnable callback) { callback.run(); }
Example #19
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.REQUIRED) public void required(Runnable callback) { callback.run(); }
Example #20
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.NEVER) public <T> T never(Supplier<T> callback) { return callback.get(); }
Example #21
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.NOT_SUPPORTED) public <T> T notSupported(Supplier<T> callback) { return callback.get(); }
Example #22
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.SUPPORTS) public <T> T supports(Supplier<T> callback) { return callback.get(); }
Example #23
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.MANDATORY) public <T> T mandatory(Supplier<T> callback) { return callback.get(); }
Example #24
Source File: TransactionService.java From cloudbreak with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.REQUIRES_NEW) public <T> T requiresNew(Supplier<T> callback) { return callback.get(); }
Example #25
Source File: TransactionalTestServiceImpl.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 4 votes |
@Override @Transactional(TxType.REQUIRES_NEW) public void doThrowing() { doOk(); throw new IllegalStateException(); }
Example #26
Source File: TransactionalTest.java From piranha with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Test value method. */ @Test public void testValue() { Transactional transactional = new TestTransactional(); assertEquals(transactional.value(), TxType.MANDATORY); }