JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Web Framework » JSF  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 JSF hibernate 到oracle 會錯誤
cool3690





發文: 44
積分: 0
於 2018-01-29 08:08 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我有一個專案
當初用mysql聯的
現在轉成oracle遇到一個問題
我連線是OK的
但要聯2個table一起查詢時就會發生錯誤,想請教大家,謝謝

1
2
3
4
5
6
7
8
9
10
11
12
13
org.hibernate.PropertyNotFoundException: Could not find setter for ZX01 on class dto.Xw
  org.hibernate.property.ChainedPropertyAccessor.getSetter(ChainedPropertyAccessor.java:66)
  org.hibernate.transform.AliasToBeanResultTransformer.initialize(AliasToBeanResultTransformer.java:121)
  org.hibernate.transform.AliasToBeanResultTransformer.transformTuple(AliasToBeanResultTransformer.java:84)
  org.hibernate.hql.internal.HolderInstantiator.instantiate(HolderInstantiator.java:95)
  org.hibernate.loader.custom.CustomLoader.getResultList(CustomLoader.java:446)
  org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2367)
  org.hibernate.loader.Loader.list(Loader.java:2362)
  org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:353)
  org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1869)
  org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:311)
  org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:141)
  bean.Show.GetXw(Show.java:40)

java dto 部分
1
2
3
4
5
6
7
8
9
10
11
12
13
public class Xw {//zx和zxw二個table
    private String zx01;
    private String zx02;
    private String zx03;
    private String zxw04;
   public Xw(){}
   public Xw(String zx01,String zx02,String zx03,String zxw04)
   {this.zx01=zx01;
   this.zx02=zx02;
   this.zx03=zx03;
   this.zxw04=zxw04;     
   }.....
}


show.java

1
2
3
4
5
6
7
8
public List GetXw()
    {
    String sql="select x.zx01 as zx01,x.zx02 as zx02,x.zx03 as zx03,w.zxw04 as zxw04 from zx_file x,zxw_file w where x.zx01=w.zxw01 and w.zxw04='apmt420'";
    
    Query query=session.createSQLQuery(sql).
            setResultTransformer(Transformers.aliasToBean(Xw.class)); 
        return query.list();
    }

JSP部分

1
2
3
4
5
6
<%
    Show sh=new Show();
     List <ZX> us=sh.Getdata();
      List <ZXW> xw=sh.Getxw();
     List <Xw> xw1=sh.GetXw();//這個會錯
%>


reply to postreply to post
作者 Re:JSF hibernate 到oracle 會錯誤 [Re:cool3690]
cool3690





發文: 44
積分: 0
於 2018-01-30 03:10 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
以解決

reply to postreply to post
» JWorld@TW »  Web Framework » JSF

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8