insert方法的返回值

2021-08-30 22:20:42 字數 490 閱讀 2024

今天碰到乙個問題,就是關於ibatis的insert方法的返回值的問題。在網上找了很多例子,自己也親自試了一下。所用的

其xml中的配置如下:

select seq_u_role.nextval as id from dual

insert into u_role(role_id,name,type,create_tm,create_peson

,other1,other2,other3 )

values (#id:integer#,#name:varchar#,#type:varchar#,

sysdate,#createpeson:varchar#,

#other1:varchar#,#other2:varchar#,#other3:varchar# )

然後在dao層的呼叫方法是:

public int insertrole(urole role)

要返回的是用序列作為的主健 經過測試 能返回插入時的主健

ibatis的insert方法的返回值

返回值竟然是id ibatis的sqlmapclient的insert方法是有返回值的,型別是object,包裹的其實就是剛剛插入的自增長欄位的值。請注意,配置檔案要這樣寫 xml insertid insertjizhan parameterclass jizhan insert into jiz...

Controller方法返回值

controller方法中定義modelandview物件並返回,物件中可新增model資料 指定view。入門程式 第一 包類 類包 方法名 public modelandview itemlist 參考 在controller方法形參上可以定義request和response,使用request...

PHP方法的返回值

不僅是php,大部分程式語言的函式或者叫方法,都可以用return來定義方法的返回值。從函式這個叫法來看,本身它就是乙個計算操作,因此,計算總會有個結果,如果你在方法體中處理了結果,比如進行了持久化儲存,那麼這個函式就不用返回任何內容。而計算的結果是要給外部使用的,這時候就要將計算結果進行返回了。r...