Announcement Announcement Module
No announcement yet.
Hibernat + Sping - How to get the Dialect property? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernat + Sping - How to get the Dialect property?

    I am wondering if there is an elegant way to get Hibernate Dialect property (basically I want to find what type of DB, mysql, ms sql, postgresql, etc. it is using ). Based on the dialect info, I'll write some native SQL to take advantage of DB-specific features using createSQLQuery.

    Currently I did not see a good way to do it. Spring did a good job to seal up SessionFactory. I also do not what to use appContext.getBean() for obvious reason.

    Any ideas?

  • #2
    hmmm, I see LocalSessionFactoryBean has a public getConfiguration method.... but I am not quite sure how to get n instance of LocalSessionFactoryBean


    • #3
      turns out that was easy - just do <ref bean="&#38;sessionFactory/>


      • #4
        <ref bean="&sessionFactory/>
        actually you have to do an "&amp;", i.e. escape the & inside the xml file as it represents a reserved char.


        • #5
          costin u r right.

          I did post &_#_38; though ("_ " added to avoid html interpretion)

          This forum software filtered it out to just "&" - sounds like a bug for this forum software...


          • #6
            Always use the quotes and the preview button. Try searching for &amp and you'll be surprized of what you will find.