Announcement

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

    Hibernate DataSource with Spring SessionFactory

    I'm trying to implement a basic ListGrid using a Hibernate DataSource, basically exactly the same as the HB Auto Derivation example in the showcase. The only difference is that I've configured the HIbernate SessionFactory using Spring. Here's my DataSource (ds.xml) file:
    Code:
    <DataSource ID="Vendor" 
        serverType="hibernate" 
        autoDeriveSchema="true"
        schemaBean="com.assaabloy.protech.shared.entities.aaos.Vendor"
        configBean="aaosSessionFactory">
        <serverObject lookupStyle="spring" bean="aaosSessionFactory"/>
    </DataSource>
    Whenever I run this I get this exception:
    Code:
    javax.servlet.ServletException: DataSource 'Vendor' failed to load due to an exception on the server:
    C:\Users\ausder\Desktop\New folder\protech\target\protech-9.0\WEB-INF\classes\hibernate.cfg.xml (The system cannot find the file specified)
    How do I tell the DataSource to use the SessionFactory from Spring?

    #2
    Could you please provide us more information, like what exactly Smartclient version you are using? And we really need more detailed log fragment with complete exception and some context around it.

    Comment


      #3
      Sorry for the late response, I'm using the latest SmartGWT 6.0 PRO. I ended up figuring this out. The issue was that I have 2 session factories for different databases. I added both session factory beans to the server.properties file and it works:

      Code:
      hibernate.config.lookupStyle: spring
      hibernate.config.bean: sessionFactory1
      hibernate.config.bean: sessionFactory2

      Comment

      Working...
      X