Hi MyBatis-Group,
first of all a big compliment to the mybatis team. We are using the
mybatis library in a code generator for a top level ORM Domain
Specific Language (
http://www.modellwerkstatt.org/videos). The best
feature of mybatis: no magic, only mapping!
I have a question regarding the managment of sql sessions. Seems that
i do the handling in a wrong manner. The situation is this:
Log4J reports various "created connection" task like:
DEBUG [AWT-EventQueue-0] - Created connection 31374579.
DEBUG [AWT-EventQueue-0] - ooo Connection Opened
DEBUG [AWT-EventQueue-0] - ==> Executing: SELECT iRoot.KEY_POS
[.....]
DEBUG [AWT-EventQueue-0] - ==> Parameters: 19709896(Integer)
DEBUG [AWT-EventQueue-0] - <== Columns: RM16COL0, RM16COL1, [....]
DEBUG [AWT-EventQueue-0] - <== Row: 83414892, 19709896, 0, 10,
143949, null, null, 2016, 12, .9454, 1,
DEBUG [AWT-EventQueue-0] - ==> Executing: SELECT iRoot.ARTIKEL [...]
DEBUG [AWT-EventQueue-0] - ==> Parameters: 143949(Integer)
DEBUG [AWT-EventQueue-0] - <== Columns: S3COL0, S3COL1, S3COL2,
S3COL3,
DEBUG [AWT-EventQueue-0] - <== Row: 143949, Napoli
Schnittenblock, 16441, 1118, 12, 1, .7929, 1
DEBUG [AWT-EventQueue-0] - <== Row: 83414893, 19709896, 0, 40,
166902, null, null, 576,
and a little bit later another "connection open" is reported ...
DEBUG [AWT-EventQueue-0] - Created connection 7647268.
DEBUG [AWT-EventQueue-0] - ooo Connection Opened
DEBUG [AWT-EventQueue-0] - ==> Executing: SELECT iRoot.KEY_POS [...]
DEBUG [AWT-EventQueue-0] - ==> Parameters: 19724652(Integer)
DEBUG [AWT-EventQueue-0] - <== Columns: RM16COL0, RM16COL1,
RM16COL2, RM16COL3, [...]
DEBUG [AWT-EventQueue-0] - <== Row: 83487929, 19724652,
83414901, 140, 188191, null, null, -5376, 16 DEBUG [AWT-EventQueue-0]
- ==> Executing: SELECT iRoot.ARTIKEL [....]
DEBUG [AWT-EventQueue-0] - ==> Parameters: 188191(Integer)
DEBUG [AWT-EventQueue-0] - <== Columns: S3COL0, S3COL1, S3COL2,
S3COL3, S3COL4, S3COL5, S3COL6,
and then very later i get ...
DEBUG [AWT-EventQueue-0] - Claimed overdue connection 7647268.
and something hangs. So obviously i do not handle the connection
correctly. But connection is not a connection to the Oracle DB,
wright? It s kind of internal mybatis connection? I m using POOLED
datasource.
What i have done in my repository class is the following:
class MyRepository {
private SqlSession Manager manager;
private IRekoMapper mapper;
@Inject
public MyRepository(SqlSessionManager m) {
manager = m;
mapper = manager.getMapper(IRekoRepo.class);
}
public List<RechnungZeile> findeRechZeilenZuRechung(int idRechnung)
{
return mapper.findeRechZeilenZuRechung(idRechnung);
}
public void insertRechnungZeile(RechnungZeile boObject) {
mapper.insertRechnungZeile(boObject);
}
}
So is it reccommended to set the connection POOL to size 1 or should i
call open/close on the mapper or on the manager ? Or is it better to
remove the SqlSessionManager
Dan