Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    It's not quite clear where the perceived problem is.. take a look at the Hibernate Integration docs - config can come from .cfg.xml, annotations, or a Spring-provided bean.

    If you don't want to use one of these methods, can you suggest some (fictitious for now) settings that would help you solve your current problem?

    Comment


      #17
      First off, thanks for the reply. I'm impressed with the responsiveness of Isomorphic staff and it's one of the reasons we've talked so highly about Smart GWT to our customers.

      Second, I read the Hibernate Integration previously and this is the documentation I believe you were referring to:

      Code:
      You can provide Hibernate configuration to the Smart GWT server in three ways:     
      
         You can place a traditional hibernate.cfg.xml file somewhere on the classpath
          You can have Smart GWT look up a Hibernate Configuration to use. This works in the same way as a ServerObject, and in fact makes use of the ServerObject code. To do this, add ServerObject-compliant properties to your server.properties file, prefixed with hibernate.config. For example:
      
                   hibernate.config.lookupStyle: spring
                   hibernate.config.bean: mySessionFactory
            
      
          You can provide a Hibernate configuration at the level of individual DataSources, by specifying a configBean on the dataSource (this is only applicable if you are using Spring; see below)
      Perhaps, I'm mis-interpreting this section, but it sounds like there are three ways to configure hibernate, but the last two both require Spring. So that leaves only the first option of placing a hibernate.cfg.xml file on the build path.

      There is a hibernate.cfg.xml file in one of the jars included in the web app and available on the class path and we could use that, but when I remove the 'SmartGWT-specific' hibernate.cfg.xml file from the webapp/WEB-INF classes directory, I get the following exception:
      Code:
      java.io.FileNotFoundException: /Users/v3ventures/Documents/Projects/Blackpoint/WizardSleeve/Code/V3/WizardSleeveV3/gwt/src/main/webapp/WEB-INF/classes/hibernate.cfg.xml (No such file or directory)
      	at java.io.FileInputStream.open(Native Method)
      So although we do have a valid .cfg.xml file on the classpath, it appears SmartGWT expects it to be in webapp/WEB-INF/classes and not say in WEB-INF/lib or even a jar in webapp/WEB-INF/classes.

      Ideally, what we'd like is to be able to use the Smart GWT hibernate configuration lookup style, but point it to a class on the classpath that has the standard Hibernate Factory methods (getSessionFactory(), getConfiguration() etc.) implemented.

      So something like:

      Code:
                   hibernate.config.lookupStyle: bean (or maybe classpath)
                   hibernate.config.bean: com.blah.blah.HibernateUtil
      And HibernateUtil implements a getConfiguration() and getSessionFactory() that the Smart GWT components can then use.

      Perhaps this is currently feasible but I'm configuring things incorrectly. Thoughts?

      The rationale behind this is we have a web-app where several libraries need database/hibernate access. So instead of having to manage and control 3 or 4 different hibernate configurations and have multiple sessionFactories running around it would be nice to just point everything to a single hibernate configuration file.

      Comment


        #18
        That facility (looking up Hibernate configuration from some class available on the classpath) is exactly what our Spring-based lookup achieves. We would just recommend using Spring to do this. It doesn't imply that you need to change anything about how any other parts of your app behave.

        Comment

        Working...
        X