Announcement Announcement Module
No announcement yet.
Mr. Persister Spring Integration... how to integrate DAO's? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mr. Persister Spring Integration... how to integrate DAO's?

    We are currently working on the Mr. Persister 3.1.0 and one of the features our users have been asking for is Spring integration. I have read the chapters 5, 6 and 7 of the "Professional Java Development with the Spring Framework", but I'm still not 100% sure what "Spring integration" means, or requires.

    Here is what I have understood so far:

    To integrate with Spring Mr. Persister will need a copy of its DAO classes that throws Springs DataAccessExceptions (or subclasses) instead of the usual Mr. Persister exceptions. The DAO class may have to subclass a special Spring DAO base class. That way a Spring DataSource bean can easily and uniformly be injected into the DAO class, and the Spring transaction proxies will know how to interprete the exceptions thrown, and act on the underlying Connection accordingly.

    Was that correct, or am I missing something here?

  • #2
    Not to be rude, you should read the other chapters.

    Spring provides a lot of flexibility in this area. You can use their base classes OR you can not use them. You can use their exception hierarchy OR you can not use it.

    Basically, you choose which mode fits your system best. However, just because you don't want their exception hierarchy doesn't mean you can't use their "special Spring DAO" base classes. With the combination of AOP you can write an aspect that translates Spring exceptions into Mr Persister exceptions. Their exception hierarchy is runtime so you'll likely not have your interfaces throwing them anway.

    The point of this simple - you don't have to use special Spring anything, but they provide certain special things for common cases that can provide some benefit. Otherwise, you can "rough it" and Spring will still be able to support you just in a lesser role.

    I've found the entire book quite useful for learning more about Spring. Another great source is their online documentation.

    Good luck


    • #3
      Originally posted by joe.witt
      Not to be rude, you should read the other chapters.
      I have :-) I have read 1 + 2 + 3 too of course, and some of 4 and 12. I can easily imagine how I can get Mr. Persister to work inside Spring. That'll take 2 minutes. But somewhere the book states that once "Spring integration" is provided, users can use Springs DAO abstraction ontop of the concrete persistence technology, thus making it easier to switch the concrete persistence technology underneath if needed.

      It is this "Spring integration" I am looking for. A uniform way for our users to integrate Mr. Persister into their Spring applications, which reduces the dependency on Mr. Persister, thus decreasing the risk of choosing Mr. Persister as a persistence solution.