Hibernate Books

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Probleme de ClassCastException avec Character et un String
PostPosted: Fri Aug 20, 2010 5:40 pm 

Joined: Wed Jan 28, 2009 8:31 pm
Posts: 54
Bonjour a tous
j ai un trouble de probleme de ClassCastException envers un
et un String voici mon dao
public List<TprchsSaleTrans> findTprchsSaleTrans()
  List<Object> l = null;
  TprchsSaleTrans prchsSaleTrans = null;
  List<TprchsSaleTrans> listReturn = new ArrayList<TprchsSaleTrans>();
try {
l = this.getHibernateTemplate().[B]findByNamedQuery[/B("tprchsSaleTransQuery");
for (Object list : l)
    Object[] element = (Object[]) list;
    prchsSaleTrans = new TprchsSaleTrans();
    prchsSaleTrans.setTprchssaletransID((Integer) element[0]);
      //dans la bd BranchCd = 199 et hibernate me sort seulement le 1 char
     [B]prchsSaleTrans.setBranchCd((String) element[1]);[/B]
      } catch (Exception e) {
      return listReturn;

mon mapping
    <class name="TprchsSaleTrans" table="tprchs_sale_trans">
         <id name="tprchssaletransID" type="java.lang.Integer">
            <column name="tprchs_sale_trans_ID" />
            <generator class="identity" />
            <property name="accountCd" type="string">
                <column name="account_cd" length="5" />
            [B]<property name="branchCd" type="string">
                <column name="branch_cd" length="3" />
    [B] <sql-query name="tprchsSaleTransQuery">
      <![CDATA[select tprchs_sale_trans_ID,branch_cd,account_cd,type_account_cd,chck_brch_acct_nbr, transaction_dt,currency_cd,sum(case when debit_credit_cd = 'C' then tran_total_amt * -1 else tran_total_amt  end) as net FROM tprchs_sale_trans where  CONVERT(varchar(20), transaction_dt,105 )   = CONVERT(varchar(20),GETDATE(),105) or (CONVERT(varchar(20), processing_dt,105 )   = CONVERT(varchar(20),GETDATE()-1,105) and  transaction_dt  <=   GETDATE() ) GROUP by branch_cd,account_cd,type_account_cd,chck_brch_acct_nbr,transaction_dt,currency_cd,tprchs_sale_trans_ID]]>

et dans mon pojo
private String branchCd;
bien sur un String
et pour finir la declaration dans la bd
branch_cd char size= 3

je comprends vraiment pas pourquoi hibernate me sort un char!!
Est ce qu ily a quelqu un qui peut m aider svp

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.