Announcement Announcement Module
Collapse
No announcement yet.
Any good COMPLETE examples of using Hibernate w/ Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Any good COMPLETE examples of using Hibernate w/ Spring

    We kinda got it working... But not in the way that the Senior Spring people would say...

    refer to thread for how we current have it working:
    http://forum.springframework.org/showthread.php?t=21112

    Our problem is, there just doesn't seem to be any complete documentation to getting Spring integrated w/ Hibernate. Sure, there are partial snippets of xml files, but really? Is that the best way to go about things...

    If you do a search for the lazy initialization problem, you will see plenty of references to use TransactaionProxyFactoryBean and then OpenSessionFilterView, but no one really seems to want to write a good example of what is the best way to approach this integration.

    It really seems the accepted status qou at the moment is just to point people at a URL about the OpenSessionFilterView (That 404's btw) and mention the above TransactionProxyFactoryBean in passing...

    Wouldn't it be a huge time saver for this community, if someone who claims the above approach is the correct way to do, to just write an entire application, it doesn't have to be a big one, that show the stated, yet not shown best way?

    I really don't mean to sound crass here, and for those that feel I am being that way, I apologize.

  • #2
    Well, personally I don't use OpenSessionInView I prefer to have my service methods hydrate my graph to a specific point and that point be part of the service interface contract. That way I can use the same service layer outside of a web app. Anway, that's sort of a tangent.

    As for a complete application, have you looked at appfuse, I think it aims at exactly what you're after. A complete application, integrating multiple open source project using spring as the glue.

    http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse

    there's also a simpler version, called equinox. Here's a quote of it's motivation:
    "I was inspired to create it while writing Spring Live (http://springlive.com)
    and looking at the struts-blank and webapp-minimal applications that ship with
    Struts and Spring, respectively. These "starter" apps were not robust enough
    for me, and I wanted something like AppFuse, only simpler."

    personally, I've never used them, but they look like what you're after.
    hope that helps,
    Jonny

    Originally posted by [email protected]
    We kinda got it working... But not in the way that the Senior Spring people would say...

    refer to thread for how we current have it working:
    http://forum.springframework.org/showthread.php?t=21112

    Our problem is, there just doesn't seem to be any complete documentation to getting Spring integrated w/ Hibernate. Sure, there are partial snippets of xml files, but really? Is that the best way to go about things...

    If you do a search for the lazy initialization problem, you will see plenty of references to use TransactaionProxyFactoryBean and then OpenSessionFilterView, but no one really seems to want to write a good example of what is the best way to approach this integration.

    It really seems the accepted status qou at the moment is just to point people at a URL about the OpenSessionFilterView (That 404's btw) and mention the above TransactionProxyFactoryBean in passing...

    Wouldn't it be a huge time saver for this community, if someone who claims the above approach is the correct way to do, to just write an entire application, it doesn't have to be a big one, that show the stated, yet not shown best way?

    I really don't mean to sound crass here, and for those that feel I am being that way, I apologize.

    Comment


    • #4
      Originally posted by [email protected]
      Our problem is, there just doesn't seem to be any complete documentation to getting Spring integrated w/ Hibernate.
      Spring + Hibernate is simple if you use an MDA framework like AndroMDA - http://www.andromda.org

      It generates all your beans, DAOs, hbm.xmls, services, exceptions and applicationContext.xml all from a UML diagram.

      All you do is fill in the stub business methods that it creates for you with your HQL or other logic and you're good to go.

      Bob

      Comment


      • #5
        Take a look at the source code of http://sourceforge.net/projects/pmr/. Regarding the lazy load issue, we used an aspect with a ghost object (see http://www.martinfowler.com/eaaCatalog/lazyLoad.html)

        A.

        Comment

        Working...
        X