Announcement Announcement Module
Collapse
No announcement yet.
How do I make a custom connection handler with Spring? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I make a custom connection handler with Spring?

    Hello,

    How can I make Spring manage connections to a non-standard database? I want the connections held open for the duration of a request, having Spring open and close the connections for me at the beginning and end of each request.

    I'm using the OKS Topic Map Engine with Spring and Spring MVC. Connecting to OKS to perform a tolog query much resembles using JDBC directly:

    Code:
    TopicMapStoreIF store = topicMapRepository.createStore(true);
    try {
        QueryProcessorIF queryProcessor = QueryUtils.getQueryProcessor(tm);
        try {
            QueryResultIF queryResult = queryProcessor.execute("<tolog query>");
            <process query>
        }
        finally {
            queryResult.close();
        }
    }
    finally {
        store.close();
    }
    I have a hunch that I need to implement a new SessionFactory, but I can't figure out the details. Also, what controls the lifecycle of my connection? I can't figure out how to get Spring to close it for me.

    I'm hoping someone might have solved a similar problem.

    - Bjorn
Working...
X