no dialect mapping for jdbc type 9 – hibernate and ms sql server

no dialect mapping for jdbc type 9

the issue: receiving the following error using hibernate and jdbc against an ms sql server database

ms sql server & hibernate: No Dialect mapping for JDBC type: -9

the solution: 2 possible “fixes” for this…

  1. try changing your driver to jTDS
    using the ms sql server jdbc driver provided by microsoft can cause this issue while jTDS does not give this complaint.

  2. you may need to explicitly “addScalar” to your hibernate query.
    you might have something like this:

    sess.createSQLQuery("SELECT * FROM CATS")

    try changing to:

    sess.createSQLQuery("SELECT * FROM CATS")
     .addScalar("ID", Hibernate.LONG)
     .addScalar("NAME", Hibernate.STRING)
     .addScalar("BIRTHDATE", Hibernate.DATE)

    related documented issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28333

Previous
Previous

ms sql server equivalent of oracle’s NVL function

Next
Next

Error: ‘CREATE VIEW’ must be the first statement in a query batch