Reputation: 1227
Hi I want to set mytypemappings to connection but I cant change datasource type mappings.setType map not work.
DataSource javax.sql,
Map map = dataSource.getConnection().getTypeMap(); map.put("mytpe", myclass); connection = dataSource.getConnection(); connection.setTypeMap(map);//(connection set and when I get I see type map) dataSource.getConnection().setTypeMap(map);//(connection set and when I get I cant see type map)
DriverManagerDataSource dataSource = new DriverManagerDataSource(connectionstringinfos);
Map<String,Class<Object> map2= dataSource.getConnection().getTypeMap();
map2.put("mymap",MyMap.class);
dataSource.getConnection().setTypeMap(map2);
dataSource.getConnection().getTypeMap();-->that time mymap does not seen
Upvotes: 1
Views: 338
Reputation: 359
Everytime you call dataSource.getConnection()
you get a new Connection
instance, so you need to add the type map to every new instance.
Upvotes: 0