-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: No Dialect mapping for JDBC type :-9
PostPosted: Thu Mar 07, 2013 10:46 pm 
Newbie

Joined: Thu Mar 07, 2013 10:11 pm
Posts: 1
Hi,
Our project is using oracle11 db and hibernate3 to do db operations,some tables's column dbtype is nvarchar2,then if i use hibernat3 primary sql to query, it will be show this error:No Dialect mapping for JDBC type :-9, how can i config and write code to avoid this error?

table:
Code:
  CREATE TABLE "ISM_ACCOUNT"."REPORT_TABLE_COL_CHECK"    (
    "ID" NUMBER(10,0) NOT NULL ENABLE,
      "TABLE_TYPE" NVARCHAR2(10) NOT NULL ENABLE,
      "NULLABLE" NUMBER(1,0),
      "MAX_LENGTH" NUMBER(10,0),
      "WORD_BOOK" NVARCHAR2(20),
      "COLUMN_NUMBER" NUMBER(5,0),
      "COLUMN_NAME" NVARCHAR2(60),
      "CREATE_TIME" DATE DEFAULT sysdate,
      "LAST_TIME" TIMESTAMP (6),
      "META_COLUMN_ID" NUMBER(10,0),
      "NULLABLE_MESSAGE" CLOB,
      "MAX_LEN_MESSAGE" NVARCHAR2(1000),
      "WORD_BOOK_MESSAGE" CLOB,
      "CHECKER_ID" NVARCHAR2(255)



ENTITY:
Code:



/**
* ReportTableColCheck entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "REPORT_TABLE_COL_CHECK", schema = "ISM_ACCOUNT")
public class ReportTableColCheck implements java.io.Serializable {

   // Fields
   private static final long serialVersionUID = 4932172468128075092L;
   private Long id;
   private String tableType;
   private Byte nullable;
   private Long maxLength;
   private String wordBook;
   private Byte columnNumber;
   private String columnName;
   private Timestamp createTime;
   private Timestamp lastTime;
   private Long metaColumnId;
   private String nullableMessage;
   private String maxLenMessage;
   private String wordBookMessage;
   private String checkerId;

   // Constructors

   /** default constructor */
   public ReportTableColCheck() {
   }

   /** minimal constructor */
   public ReportTableColCheck(String tableType) {
      this.tableType = tableType;
   }

   // Property accessors
   @SequenceGenerator(name = "generator",sequenceName="S_REPORT_TABLE_COL_CHECK")
   @Id
   @GeneratedValue(strategy = SEQUENCE, generator = "generator")
   @Column(name = "ID", unique = true, nullable = false, precision = 10, scale = 0)
   public Long getId() {
      return this.id;
   }

   public void setId(Long id) {
      this.id = id;
   }

   @Column(name = "TABLE_TYPE", nullable = false, length = 10)
   public String getTableType() {
      return this.tableType;
   }

   public void setTableType(String tableType) {
      this.tableType = tableType;
   }

   @Column(name = "NULLABLE", precision = 1, scale = 0)
   public Byte getNullable() {
      return this.nullable;
   }

   public void setNullable(Byte nullable) {
      this.nullable = nullable;
   }

   @Column(name = "MAX_LENGTH", precision = 10, scale = 0)
   public Long getMaxLength() {
      return this.maxLength;
   }

   public void setMaxLength(Long maxLength) {
      this.maxLength = maxLength;
   }

   @Column(name = "WORD_BOOK", length = 20)
   public String getWordBook() {
      return this.wordBook;
   }

   public void setWordBook(String wordBook) {
      this.wordBook = wordBook;
   }

   @Column(name = "COLUMN_NUMBER", precision = 5, scale = 0)
   public Byte getColumnNumber() {
      return this.columnNumber;
   }

   public void setColumnNumber(Byte columnNumber) {
      this.columnNumber = columnNumber;
   }

   @Column(name = "COLUMN_NAME", length = 60)
   public String getColumnName() {
      return this.columnName;
   }

   public void setColumnName(String columnName) {
      this.columnName = columnName;
   }

   @Column(name = "CREATE_TIME", length = 7)
   public Timestamp getCreateTime() {
      return this.createTime;
   }

   public void setCreateTime(Timestamp createTime) {
      this.createTime = createTime;
   }

   @Column(name = "LAST_TIME", length = 7)
   public Timestamp getLastTime() {
      return this.lastTime;
   }

   public void setLastTime(Timestamp lastTime) {
      this.lastTime = lastTime;
   }

   @Column(name = "META_COLUMN_ID", precision = 10, scale = 0)
   public Long getMetaColumnId() {
      return this.metaColumnId;
   }

   public void setMetaColumnId(Long metaColumnId) {
      this.metaColumnId = metaColumnId;
   }

   @Column(name = "NULLABLE_MESSAGE")
   public String getNullableMessage() {
      return this.nullableMessage;
   }

   public void setNullableMessage(String nullableMessage) {
      this.nullableMessage = nullableMessage;
   }

   @Column(name = "MAX_LEN_MESSAGE", length = 20)
   public String getMaxLenMessage() {
      return this.maxLenMessage;
   }

   public void setMaxLenMessage(String maxLenMessage) {
      this.maxLenMessage = maxLenMessage;
   }

   @Column(name = "WORD_BOOK_MESSAGE")
   public String getWordBookMessage() {
      return this.wordBookMessage;
   }

   public void setWordBookMessage(String wordBookMessage) {
      this.wordBookMessage = wordBookMessage;
   }

   @Column(name = "CHECKER_ID")
   public String getCheckerId() {
      return this.checkerId;
   }

   public void setCheckerId(String checkerId) {
      this.checkerId = checkerId;
   }

}


JAVA search code:
Code:
public List<ReportTableColumnNumber> findReportTableNumber() {
         List<ReportTableColumnNumber> resList = new ArrayList<ReportTableColumnNumber>();
         String reportTableHqlByType = "select table_type, count(table_type) nums from report_table_col_check group by table_type order by table_type ";
         Query query = getSession().createSQLQuery(reportTableHqlByType);
//        String reportTableHqlByType = "select tableType, count(tableType) from ReportTableColCheck group by tableType order by tableType ";
//        Query query = getSession().createQuery(reportTableHqlByType);
         List<?> list = query.list();
         for (int i = 0; i < list.size(); i++) {
             ReportTableColumnNumber rn = new ReportTableColumnNumber();
             Object[] ovalue = (Object[])list.get(i);
             String type = (String) ovalue[0];
             BigDecimal  nums = (BigDecimal) ovalue[1];
//            Long  nums = (Long) ovalue[1];
             rn.setTableCode(type);
             rn.setColumnNumber(String.valueOf(nums.longValue()));
             resList.add(rn);
         }
         return resList;
     }


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.