• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mybatis / ibatis-2 / 782

10 Jan 2026 07:20PM UTC coverage: 65.006% (-0.6%) from 65.569%
782

Pull #357

github

web-flow
Merge 0ddca70a8 into 1658b93ec
Pull Request #357: Wire in support to allow javax or jakarta transaction support transparent to user

1599 of 2829 branches covered (56.52%)

8 of 81 new or added lines in 6 files covered. (9.88%)

5023 of 7727 relevant lines covered (65.01%)

0.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/ibatis/sqlmap/engine/transaction/jta/JakartaTransactionConfig.java
1
/*
2
 * Copyright 2004-2026 the original author or authors.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *    https://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.ibatis.sqlmap.engine.transaction.jta;
17

18
import com.ibatis.sqlmap.client.SqlMapException;
19
import com.ibatis.sqlmap.engine.transaction.BaseTransactionConfig;
20
import com.ibatis.sqlmap.engine.transaction.Transaction;
21
import com.ibatis.sqlmap.engine.transaction.TransactionException;
22

23
import jakarta.transaction.UserTransaction;
24

25
import java.sql.SQLException;
26
import java.util.Properties;
27

28
import javax.naming.InitialContext;
29
import javax.naming.NamingException;
30

31
/**
32
 * The Class JtaTransactionConfig.
33
 */
NEW
34
public class JakartaTransactionConfig extends BaseTransactionConfig {
×
35

36
  /** The user transaction. */
37
  private UserTransaction userTransaction;
38

39
  @Override
40
  public Transaction newTransaction(int transactionIsolation) throws SQLException, TransactionException {
NEW
41
    return new JakartaTransaction(userTransaction, dataSource, transactionIsolation);
×
42
  }
43

44
  /**
45
   * Gets the user transaction.
46
   *
47
   * @return the user transaction
48
   */
49
  public UserTransaction getUserTransaction() {
NEW
50
    return userTransaction;
×
51
  }
52

53
  /**
54
   * Sets the user transaction.
55
   *
56
   * @param userTransaction
57
   *          the new user transaction
58
   */
59
  public void setUserTransaction(UserTransaction userTransaction) {
NEW
60
    this.userTransaction = userTransaction;
×
NEW
61
  }
×
62

63
  @Override
64
  public void setProperties(Properties props) throws SQLException, TransactionException {
NEW
65
    String utxName = null;
×
66
    try {
NEW
67
      utxName = (String) props.get("UserTransaction");
×
NEW
68
      InitialContext initCtx = new InitialContext();
×
NEW
69
      userTransaction = (UserTransaction) initCtx.lookup(utxName);
×
NEW
70
    } catch (NamingException e) {
×
NEW
71
      throw new SqlMapException(
×
72
          "Error initializing JtaTransactionConfig while looking up UserTransaction (" + utxName + ").  Cause: " + e);
NEW
73
    }
×
NEW
74
  }
×
75

76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc