title: Getting the following error org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
body: <p>I am getting following exception at query.can you please tell mw whats wrong is in my code? </p>
  
  <pre><code>org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
  at org.hibernate.dialect.TypeNames.get(TypeNames.java:79)
  at org.hibernate.dialect.TypeNames.get(TypeNames.java:104)
  at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:393)
  at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:582 
      at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(Custom Loader.java:508)
      at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:524)
      at org.hibernate.loader.Loader.getResultSet(Loader.java:1821)
      at org.hibernate.loader.Loader.doQuery(Loader.java:697)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
      at org.hibernate.loader.Loader.doList(Loader.java:2232)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
      at org.hibernate.loader.Loader.list(Loader.java:2124)
      at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
      at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723)
      at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
      at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
      at com.bdisys.promorphics.dao.impl.BlogDaoImpl.getTopBlogsQuesByDate(BlogDaoImpl.java:126)
      at org.apache.jsp.Mydetails_jsp._jspService(Mydetails_jsp.java:935)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
      at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
      at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
      at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
      at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Blog.java :</p>
  
  <pre><code>@SuppressWarnings("serial")
      @Entity
      @Table(name="blog")
      public class Blog extends BaseDomain {
  
      @Column(name="blog_title")
      private String blogTitle;
  
      @Column(name="blog_text",columnDefinition="TEXT")
      private String blogText;
  
      @Enumerated(EnumType.STRING)
      @Column(name="blog_status")
      private Status blogStatus; 
  
      @OneToOne
      @JoinColumn(name="created_by", nullable=false)
      private User createdBy;
  
      @OneToOne
      @JoinColumn(name="blog_category", nullable=false)
      private BlogCategory blogCategory;
  
      @Temporal(TemporalType.DATE)
      @Column(name="created_date")
      private Date createdDate; 
  
      @Column(name="likes")
      private Long likes;
  
      @Column(name="uploads")
      private String uploads;
  
      @Column(name="youtube_link")
      private String youTubeLik;
  
      @Column(name="moderator_comment")
      private String moderatorComment;
  
      @Lob
      @Column(name="blog_description")
      private String blog_desc;
  
      @ManyToOne
      @JoinColumn(name="users")
      private User users;
  
      public User getUsers() {
      return users;
      }
  
      public void setUsers(User users) {
       this.users = users;
      }
  
      public String getBlog_desc() {
      return blog_desc;
      }
  
      public void setBlog_desc(String blog_desc) {
      this.blog_desc = blog_desc;
      }
  
      public String getBlogTitle() {
      return blogTitle;
      }
  
      public void setBlogTitle(String blogTitle) {
      this.blogTitle = blogTitle;
      }
  
      public String getBlogText() {
      return blogText;
      }
  
      public void setBlogText(String blogText) {
      this.blogText = blogText;
      }
  
      public Status getBlogStatus() {
      return blogStatus;
      }
  
      public void setBlogStatus(Status blogStatus) {
      this.blogStatus = blogStatus;
      }
  
      public User getCreatedBy() {
      return createdBy;
      }
  
      public void setCreatedBy(User createdBy) {
      this.createdBy = createdBy;
      }
  
      public BlogCategory getBlogCategory() {
      return blogCategory;
      }
  
      public void setBlogCategory(BlogCategory blogCategory) {
      this.blogCategory = blogCategory;
      }
  
      public Date getCreatedDate() {
      return createdDate;
      }
  
      public void setCreatedDate(Date createdDate) {
      this.createdDate = createdDate;
      }
  
      public Long getLikes() {
      return likes;
      }
  
      public void setLikes(Long likes) {
      this.likes = likes;
      }
  
      public String getUploads() {
      return uploads;
      }
  
      public void setUploads(String uploads) {
      this.uploads = uploads;
      }
  
      public String getYouTubeLik() {
      return youTubeLik;
      }
  
      public void setYouTubeLik(String youTubeLik) {
      this.youTubeLik = youTubeLik;
      }
  
      public String getModeratorComment() {
      return moderatorComment;
      }
  
      public void setModeratorComment(String moderatorComment) {
      this.moderatorComment = moderatorComment;
      }
  
  
  
      }
  </code></pre>
  
  <p>Askquestions.java :</p>
  
  <pre><code> @SuppressWarnings("serial")
      @Entity
       @Table(name="askquestions")
      public class Askquestions extends BaseDomain {  
  
  @Column(length = 100, name = "id_subscribers")
  private String idSubscribers;
  
  @Column(length = 100, name = "is_anonymous")
  private String isAnonymous;
  
  @Column(length = 100, name = "display_name")
  private String displayName;
  
  @Temporal(TemporalType.DATE)
      @Column(length = 100, name = "created_on")
  private Date createdQuesOn;
  
  @Lob
  @Column(name = "ask_question")
  private String askQuestion;
  
  @Column(length = 100, name = "ask_to_whom")
  private String askToWhom;
  
  @Lob
  @Column(name="question_of_day")
  private String questionOfDay;
  
  @ManyToOne
   @JoinColumn(name="ask_category")
   private Askcategory askcategory;
  
   @ManyToOne
      @JoinColumn(name="users")
      private User users;
  
  public User getUsers() {
      return users;
  }
  
  public void setUsers(User users) {
      this.users = users;
  }
  
  
  public Askcategory getAskcategory() {
      return askcategory;
  }
  
  public void setAskcategory(Askcategory askcategory) {
      this.askcategory = askcategory;
  }
  
  public String getQuestionOfDay() {
          return questionOfDay;
      }
  
      public void setQuestionOfDay(String questionOfDay) {
          this.questionOfDay = questionOfDay;
      }
  
  public String getIdSubscribers() {
      return idSubscribers;
  }
  
  public void setIdSubscribers(String idSubscribers) {
      this.idSubscribers = idSubscribers;
  }
  
  public String getIsAnonymous() {
      return isAnonymous;
  }
  
  public void setIsAnonymous(String isAnonymous) {
      this.isAnonymous = isAnonymous;
  }
  
  public String getDisplayName() {
      return displayName;
  }
  
  public void setDisplayName(String displayName) {
      this.displayName = displayName;
  }
  
  public String getAskQuestion() {
      return askQuestion;
  }
  
  public void setAskQuestion(String askQuestion) {
      this.askQuestion = askQuestion;
  }
  
  public String getAskToWhom() {
      return askToWhom;
  }
  
  public void setAskToWhom(String askToWhom) {
      this.askToWhom = askToWhom;
  }
  
  public Date getCreatedQuesOn() {
      return createdQuesOn;
  }
  
  public void setCreatedQuesOn(Date createdQuesOn) {
      this.createdQuesOn = createdQuesOn;
  }
  
  
      } 
  </code></pre>
  
  <p>BlogDaoimpl Method:this query is not getting executed while other small queries are getting executed.why is it    happening????</p>
  
  <pre><code>     String sql = "  select title , date from (select blog_title as title ,created_date          as date from  blog  union select ask_question as title , created_on as date from askquestions ) as aa order by date desc";
  
     SQLQuery query = getSession().createSQLQuery(sql);
  
      return query.list();
  </code></pre>
  
  <p>hibrnate.cfg.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
       &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;
          com.mysql.jdbc.Driver
      &lt;/property&gt;
    &lt;!-- &lt;property name="hibernate.connection.password"&gt;websitebdi&lt;/property&gt;
      &lt;property    name="hibernate.connection.url"&gt;jdbc:mysql://184.172.182.251:3306/bdiwebsite&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;bdiwebsite&lt;/property&gt;  --&gt;
  
      &lt;property name="hibernate.connection.password"&gt;MAYbdiSYS2008&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://115.119.114.10:3306/bdisystems&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;admin&lt;/property&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
      &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
      &lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt;
      &lt;property name="hibernate.show_sql"&gt;false&lt;/property&gt;
      &lt;property name="format_sql"&gt;true&lt;/property&gt;
      &lt;property name="use_sql_comments"&gt;true&lt;/property&gt;
  
  
      &lt;property name="hibernate.connection.provider_class"&gt;
          org.hibernate.connection.C3P0ConnectionProvider
      &lt;/property&gt;
      &lt;!--  The maximum number of connections  --&gt;
      &lt;property name="hibernate.c3p0.max_size"&gt;20&lt;/property&gt;
      &lt;!--  The minimum number of connections  --&gt;
      &lt;property name="hibernate.c3p0.min_size"&gt;5&lt;/property&gt;
      &lt;!--  Get a connection timeout  , If you exceed this time  , Throws an exception, in milliseconds  --&gt;
      &lt;property name="hibernate.c3p0.timeout"&gt;120&lt;/property&gt;
      &lt;!--  The maximum number of PreparedStatement  --&gt;
      &lt;property name="hibernate.c3p0.max_statements"&gt;100&lt;/property&gt;
      &lt;!--  Every 120 seconds checking connection idle connection in the pool, the unit is in seconds  --&gt;
      &lt;property name="hibernate.c3p0.idle_test_period"&gt;120&lt;/property&gt;
      &lt;!--  When connection pooling connections inside out, look at the new C3P0     get the number of connections  --&gt;
      &lt;property name="hibernate.c3p0.acquire_increment"&gt;2&lt;/property&gt;
      &lt;!--  Always verify the connection  --&gt;
      &lt;property name="hibernate.c3p0.validate"&gt;true&lt;/property&gt;
      &lt;!--    
          &lt;property name="hibernate.c3p0.max_size"&gt;100&lt;/property&gt;
          &lt;property name="hibernate.c3p0.min_size"&gt;0&lt;/property&gt;
          &lt;property name="hibernate.c3p0.acquire_increment"&gt;1&lt;/property&gt;
          &lt;property name="hibernate.c3p0.idle_test_period"&gt;300&lt;/property&gt;
          &lt;property name="hibernate.c3p0.max_statements"&gt;0&lt;/property&gt;
          &lt;property name="hibernate.c3p0.timeout"&gt;100&lt;/property&gt;
      --&gt;
  
      &lt;!-- Mapping Classes --&gt;
  
      &lt;mapping class="com.bdisys.promorphics.domain.BlogCategory"/&gt;
      &lt;mapping class="com.bdisys.promorphics.domain.Blog"/&gt;
  
      &lt;mapping class="com.bdisys.promorphics.domain.Career"/&gt;
      &lt;mapping class="com.bdisys.promorphics.domain.Partners"/&gt;
      &lt;mapping class="com.bdisys.promorphics.domain.Askcategory"/&gt;
      &lt;mapping class="com.bdisys.promorphics.domain.Askquestions"/&gt;
      &lt;mapping class="com.bdisys.promorphics.domain.Askanswers"/&gt;
  
  &lt;/session-factory&gt;
      &lt;/hibernate-configuration&gt;
  </code></pre>