ibatis: 能select出对象,但对象的每个属性都是null ?


  1. 你的select statement没用resultMap,但用了resultClass

  2. 而且你的select语句里没有使用 select
coloumn_name as
propertName 这种格式。 你可能省略了 as

另外,使用 "select
coloumn_name as

Using SQL aliases to map columns to properties saves defining a <resultMap> element, but there are limitations. There is no way to specify the types of the output columns (if needed), there is no way to automatically load related data such as complex properties, and there is a slight performance consequence from accessing the result metadata. Architecturally, using aliases this way mixes database logic with reporting logic, making the query harder to read and maintain. You can overcome these limitations with an explicit Result Map (Section 3.5).

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.