ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Hagström <ste...@iserv.se>
Subject Problem with ibatis3 in jboss5.1 - Not closing connection.
Date Wed, 13 Jan 2010 21:43:22 GMT




Hi!

I'm new to Ibatis, and have tried to create a simple slsb as a dao  
with ibatis 3 with jboss 5.

However it seems like connection are not closed/returned. Jboss is  
complaining about connections not beeing closed:

21:32:15,146 INFO  [CachedConnectionManager] Closing a connection for  
you.  Please close them yourself:  
org.jboss.resource.adapter.jdbc.jdk5.WrappedConnectionJDK5@8cffca
java.lang.Throwable: STACKTRACE

I've attached the configuration and slsb, any ideas?


<configuration>
<settings>
	<setting name="cacheEnabled" value="false"/>
	<setting name="lazyLoadingEnabled" value="false"/>
</settings>
   <typeAliases>
     <typeAlias type="dto.valuecode.ValueCode" alias="ValueCode"/>
   </typeAliases>

   <environments default="prod">

       	<environment id="prod">
       		<transactionManager type="MANAGED">
       		</transactionManager>
       		<dataSource type="JNDI">
         		<property name="data_source" value="java:/kalenderDB"/>
       		</dataSource>
     	</environment>
   </environments>


   <mappers>
     <mapper resource="META-INF/ValueCode.xml"/>
   </mappers>
</configuration>



@Stateless
public class ValueCodeDao implements ValueCodeDaoInterface {

	SqlSessionFactory sqlSessionFactory=null;
	
	@PostConstruct
	public void setup(){
		
		System.out.println("Reading Ibatis configuration for ValueCodeDao");
		
		String resource = "META-INF/ibatis.xml";
		Reader reader;
		try {
			reader =  
Resources 
.getResourceAsReader(this.getClass().getClassLoader(),resource);
			sqlSessionFactory =  new SqlSessionFactoryBuilder().build(reader);
			
			
		} catch (IOException e) {
			
			e.printStackTrace();
		}
		
	}


	public int getNextValueCodeNumber(){
			
		SqlSession session = sqlSessionFactory.openSession();	
		session.close();
					
		return 1;
		
	}
	
	
}


Mime
View raw message