001package gu.sql2java; 002import java.util.List; 003 004import gu.sql2java.exception.ObjectRetrievalException; 005import gu.sql2java.exception.RuntimeDaoException; 006 007import java.util.Collection; 008/** 009 * Interface to handle database calls (save, load, count, etc...) for table. 010 * @author guyadong 011 */ 012public interface TableManager<B extends BaseBean> extends SqlRunner{ 013 014 public interface Action<B>{ 015 016 /** 017 * do action for {@code bean} 018 * @param bean input bean 019 */ 020 void call(B bean); 021 } 022 /** 023 * interface for iterate 024 */ 025 public interface DoEach<B>{ 026 /** 027 * do action for {@code bean}<br> 028 * <b>NOTE:</b><br>DO NOT run deletion operation in the method 029 * @param bean 030 * @return remove the row if {@code true} 031 * @throws Exception 032 */ 033 boolean doEach(B bean) throws Exception; 034 } 035 //_____________________________________________________________________ 036 // 037 // COUNT 038 //_____________________________________________________________________ 039 //24 040 /** 041 * Retrieves the number of rows of the table. 042 * 043 * @return the number of rows returned 044 * @throws RuntimeDaoException 045 */ 046 public int countAll()throws RuntimeDaoException; 047 048 //27 049 /** 050 * count the number of elements of a specific bean 051 * 052 * @param bean the bean to look for ant count 053 * @return the number of rows returned 054 * @throws RuntimeDaoException 055 */ 056 public int countUsingTemplate( B bean)throws RuntimeDaoException; 057 058 //20 059 /** 060 * count the number of elements of a specific bean given the search type 061 * 062 * @param bean the template to look for 063 * @param searchType exact ? like ? starting like ? ending link ? <br> 064 * {@value Constant#SEARCH_EXACT} {@link Constant#SEARCH_EXACT} <br> 065 * {@value Constant#SEARCH_LIKE} {@link Constant#SEARCH_LIKE} <br> 066 * {@value Constant#SEARCH_STARTING_LIKE} {@link Constant#SEARCH_STARTING_LIKE} <br> 067 * {@value Constant#SEARCH_ENDING_LIKE} {@link Constant#SEARCH_ENDING_LIKE} <br> 068 * @return the number of rows returned 069 * @throws RuntimeDaoException 070 */ 071 public int countUsingTemplate(B bean, int searchType)throws RuntimeDaoException; 072 073 //25 074 /** 075 * Retrieves the number of rows of the table with a 'where' clause. 076 * It is up to you to pass the 'WHERE' in your where clauses. 077 * 078 * @param where the restriction clause 079 * @return the number of rows returned 080 * @throws RuntimeDaoException 081 */ 082 public int countWhere(String where)throws RuntimeDaoException; 083 084 //10 085 /** 086 * Deletes all rows from table. 087 * @return the number of deleted rows. 088 * @throws RuntimeDaoException 089 */ 090 public int deleteAll()throws RuntimeDaoException; 091 092 //11 093 /** 094 * Deletes rows from the table using a 'where' clause. 095 * It is up to you to pass the 'WHERE' in your where clauses. 096 * <br>Attention, if 'WHERE' is omitted it will delete all records. 097 * 098 * @param where the sql 'where' clause 099 * @return the number of deleted rows 100 * @throws RuntimeDaoException 101 */ 102 public int deleteByWhere(String where)throws RuntimeDaoException; 103 104 //21 105 /** 106 * Deletes rows using a template. 107 * 108 * @param bean the template object(s) to be deleted 109 * @return the number of deleted objects 110 * @throws RuntimeDaoException 111 */ 112 public int deleteUsingTemplate(B bean)throws RuntimeDaoException; 113 114 //2.1 115 /** 116 * Delete row according to its primary keys. 117 * 118 * @param keys primary keys value<br> 119 * for fd_face table<br> 120 * PK# 1 fd_face.id type Integer<br> 121 * for fd_feature table<br> 122 * PK# 1 fd_feature.md5 type String<br> 123 * for fd_image table<br> 124 * PK# 1 fd_image.md5 type String<br> 125 * for fd_store table<br> 126 * PK# 1 fd_store.md5 type String<br> 127 * @return the number of deleted rows 128 * @throws RuntimeDaoException 129 */ 130 public int deleteByPrimaryKey(Object ...keys)throws RuntimeDaoException; 131 132 //2.2 133 /** 134 * Delete row according to primary keys of bean.<br> 135 * 136 * @param bean will be deleted ,all keys must not be null 137 * @return the number of deleted rows,0 returned if bean is null 138 * @throws RuntimeDaoException 139 */ 140 public int delete(B bean)throws RuntimeDaoException; 141 142 //2.4 143 /** 144 * Delete beans.<br> 145 * 146 * @param beans B array will be deleted 147 * @return the number of deleted rows 148 * @throws RuntimeDaoException 149 */ 150 @SuppressWarnings("unchecked") 151 public int delete(B... beans)throws RuntimeDaoException; 152 153 //2.5 154 /** 155 * Delete beans.<br> 156 * 157 * @param beans B collection will be deleted 158 * @return the number of deleted rows 159 * @throws RuntimeDaoException 160 */ 161 public int delete(Collection<B> beans)throws RuntimeDaoException; 162 ////////////////////////////////////// 163 // LOAD ALL 164 ////////////////////////////////////// 165 166 //5 167 /** 168 * Loads all the rows from table. 169 * 170 * @return an array of B bean 171 * @throws RuntimeDaoException 172 */ 173 public B[] loadAll()throws RuntimeDaoException; 174 175 //5-1 176 /** 177 * Loads each row from table and dealt with action. 178 * @param action Action object for do something(not null) 179 * @return the count dealt by action 180 * @throws RuntimeDaoException 181 */ 182 public int loadAll(Action<B> action)throws RuntimeDaoException; 183 184 //6 185 /** 186 * Loads the given number of rows from table, given the start row. 187 * 188 * @param startRow the start row to be used (first row = 1, last row = -1) 189 * @param numRows the number of rows to be retrieved (all rows = a negative number) 190 * @return an array of B bean 191 * @throws RuntimeDaoException 192 */ 193 public B[] loadAll(int startRow, int numRows)throws RuntimeDaoException; 194 195 //6-1 196 /** 197 * Loads the given number of rows from table, given the start row and dealt with action. 198 * @param startRow the start row to be used (first row = 1, last row = -1) 199 * @param numRows the number of rows to be retrieved (all rows = a negative number) 200 * @param action Action object for do something(not null) 201 * @return the count dealt by action 202 * @throws RuntimeDaoException 203 */ 204 public int loadAll(int startRow, int numRows,Action<B> action)throws RuntimeDaoException; 205 206 //5-2 207 /** 208 * Loads all the rows from table. 209 * 210 * @return a list of B bean 211 * @throws RuntimeDaoException 212 */ 213 public List<B> loadAllAsList()throws RuntimeDaoException; 214 215 //6-2 216 /** 217 * Loads the given number of rows from table, given the start row. 218 * 219 * @param startRow the start row to be used (first row = 1, last row = -1) 220 * @param numRows the number of rows to be retrieved (all rows = a negative number) 221 * @return a list of B bean 222 * @throws RuntimeDaoException 223 */ 224 public List<B> loadAllAsList(int startRow, int numRows)throws RuntimeDaoException; 225 226 //1.2 227 /** 228 * Loads a B bean from the table using primary key fields of {@code bean}. 229 * @param bean the B bean with primary key fields 230 * @return a unique B or {@code null} if not found or bean is null 231 * @throws RuntimeDaoException 232 */ 233 public B loadByPrimaryKey(B bean)throws RuntimeDaoException; 234 235 //1.2.2 236 /** 237 * see also {@link #loadByPrimaryKey(BaseBean)} 238 * @param bean 239 * @return a unique B ,otherwise throw exception 240 * @throws ObjectRetrievalException not found 241 * @throws RuntimeDaoException 242 */ 243 public B loadByPrimaryKeyChecked(B bean)throws RuntimeDaoException,ObjectRetrievalException; 244 //1.3 245 /** 246 * Loads a B bean from the table using primary key fields. 247 * when you don't know which is primary key of table,you can use the method. 248 * @param keys primary keys value:<br> 249 * for fd_face table<br> 250 * PK# 1 fd_face.id type Integer<br> 251 * for fd_feature table<br> 252 * PK# 1 fd_feature.md5 type String<br> 253 * for fd_image table<br> 254 * PK# 1 fd_image.md5 type String<br> 255 * for fd_store table<br> 256 * PK# 1 fd_store.md5 type String<br> 257 * @return a unique B or {@code null} if not found 258 * @throws RuntimeDaoException 259 */ 260 public B loadByPrimaryKey(Object ...keys)throws RuntimeDaoException; 261 262 //1.3.2 263 /** 264 * see also {@link #loadByPrimaryKey(Object...)} 265 * @param keys 266 * @return a unique B,otherwise throw exception 267 * @throws ObjectRetrievalException not found 268 * @throws RuntimeDaoException 269 */ 270 public B loadByPrimaryKeyChecked(Object ...keys)throws RuntimeDaoException,ObjectRetrievalException; 271 272 //1.5 273 /** 274 * Returns true if this table contains row with primary key fields. 275 * @param keys primary keys value 276 * @see #loadByPrimaryKey(Object...) 277 * @return 278 * @throws RuntimeDaoException 279 */ 280 public boolean existsPrimaryKey(Object ...keys)throws RuntimeDaoException; 281 282 //1.6 283 /** 284 * Returns true if this table contains row specified by primary key fields of B.<br> 285 * when you don't know which is primary key of table,you can use the method. 286 * @param bean the B bean with primary key fields 287 * @return 288 * @see #loadByPrimaryKey(BaseBean) 289 * @throws RuntimeDaoException 290 */ 291 public boolean existsByPrimaryKey(B bean)throws RuntimeDaoException; 292 //1.7 293 /** 294 * Check duplicated row by primary keys,if row exists throw exception 295 * @param bean the B bean with primary key fields 296 * @return always bean 297 * @see #existsByPrimaryKey(BaseBean) 298 * @throws ObjectRetrievalException has duplicated record 299 * @throws RuntimeDaoException 300 */ 301 public B checkDuplicate(B bean)throws RuntimeDaoException,ObjectRetrievalException; 302 303 ////////////////////////////////////// 304 // SQL 'WHERE' METHOD 305 ////////////////////////////////////// 306 //7 307 /** 308 * Retrieves an array of B given a sql 'where' clause. 309 * 310 * @param where the sql 'where' clause 311 * @return 312 * @throws RuntimeDaoException 313 */ 314 public B[] loadByWhere(String where)throws RuntimeDaoException; 315 316 //7-1 317 /** 318 * Retrieves each row of B bean given a sql 'where' clause and dealt with action. 319 * @param where the sql 'where' clause 320 * @param action Action object for do something(not null) 321 * @return the count dealt by action 322 * @throws RuntimeDaoException 323 */ 324 public int loadByWhere(String where,Action<B> action)throws RuntimeDaoException; 325 326 //8 327 /** 328 * Retrieves an array of B bean given a sql where clause, and a list of fields. 329 * It is up to you to pass the 'WHERE' in your where clauses. 330 * 331 * @param where the sql 'WHERE' clause 332 * @param fieldList array of field's ID 333 * @return 334 * @throws RuntimeDaoException 335 */ 336 public B[] loadByWhere(String where, int[] fieldList)throws RuntimeDaoException; 337 338 //8-1 339 /** 340 * Retrieves each row of B bean given a sql where clause, and a list of fields, 341 * and dealt with action. 342 * It is up to you to pass the 'WHERE' in your where clauses. 343 * @param where the sql 'WHERE' clause 344 * @param fieldList array of field's ID 345 * @param action Action object for do something(not null) 346 * @return the count dealt by action 347 * @throws RuntimeDaoException 348 */ 349 public int loadByWhere(String where, int[] fieldList,Action<B> action)throws RuntimeDaoException; 350 351 //9 352 /** 353 * Retrieves an array of B bean given a sql where clause and a list of fields, and startRow and numRows. 354 * It is up to you to pass the 'WHERE' in your where clauses. 355 * 356 * @param where the sql 'where' clause 357 * @param fieldList table of the field's associated constants 358 * @param startRow the start row to be used (first row = 1, last row = -1) 359 * @param numRows the number of rows to be retrieved (all rows = a negative number) 360 * @return 361 * @throws RuntimeDaoException 362 */ 363 public B[] loadByWhere(String where, int[] fieldList, int startRow, int numRows)throws RuntimeDaoException; 364 365 //9-1 366 /** 367 * Retrieves each row of B bean given a sql where clause and a list of fields, and startRow and numRows, 368 * and dealt with action. 369 * It is up to you to pass the 'WHERE' in your where clauses. 370 * 371 * @param where the sql 'where' clause 372 * @param fieldList table of the field's associated constants 373 * @param startRow the start row to be used (first row = 1, last row = -1) 374 * @param numRows the number of rows to be retrieved (all rows = a negative number) 375 * @param action Action object for do something(not null) 376 * @return the count dealt by action 377 * @throws RuntimeDaoException 378 */ 379 public int loadByWhere(String where, int[] fieldList, int startRow, int numRows,Action<B> action)throws RuntimeDaoException; 380 //7 381 /** 382 * Retrieves a list of B bean given a sql 'where' clause. 383 * 384 * @param where the sql 'where' clause 385 * @return 386 * @throws RuntimeDaoException 387 */ 388 public List<B> loadByWhereAsList(String where)throws RuntimeDaoException; 389 390 //8 391 /** 392 * Retrieves a list of B bean given a sql where clause, and a list of fields. 393 * It is up to you to pass the 'WHERE' in your where clauses. 394 * 395 * @param where the sql 'WHERE' clause 396 * @param fieldList array of field's ID 397 * @return 398 * @throws RuntimeDaoException 399 */ 400 public List<B> loadByWhereAsList(String where, int[] fieldList)throws RuntimeDaoException; 401 402 //9-2 403 /** 404 * Retrieves a list of B bean given a sql where clause and a list of fields, and startRow and numRows. 405 * It is up to you to pass the 'WHERE' in your where clauses. 406 * 407 * @param where the sql 'where' clause 408 * @param fieldList table of the field's associated constants 409 * @param startRow the start row to be used (first row = 1, last row = -1) 410 * @param numRows the number of rows to be retrieved (all rows = a negative number) 411 * @return 412 * @throws RuntimeDaoException 413 */ 414 public List<B> loadByWhereAsList(String where, int[] fieldList, int startRow, int numRows)throws RuntimeDaoException; 415 416 //9-3 417 /** 418 * Retrieves each row of B bean given a sql where clause and a list of fields, and startRow and numRows, 419 * and dealt wity action 420 * It is up to you to pass the 'WHERE' in your where clauses. 421 * 422 * @param where the sql 'where' clause 423 * @param fieldList table of the field's associated constants 424 * @param startRow the start row to be used (first row = 1, last row = -1) 425 * @param numRows the number of rows to be retrieved (all rows = a negative number) 426 * @param action Action object for do something(not null) 427 * @return the count dealt by action 428 * @throws RuntimeDaoException 429 */ 430 public int loadByWhereForAction(String where, int[] fieldList, int startRow, int numRows,Action<B> action)throws RuntimeDaoException; 431 432 //_____________________________________________________________________ 433 // 434 // USING TEMPLATE 435 //_____________________________________________________________________ 436 //18 437 /** 438 * Loads a unique B bean from a template one giving a c 439 * 440 * @param bean the B bean to look for 441 * @return the bean matching the template,or {@code null} if not found or null input argument 442 * @throws ObjectRetrievalException more than one row 443 * @throws RuntimeDaoException 444 */ 445 public B loadUniqueUsingTemplate(B bean)throws RuntimeDaoException; 446 447 //18-1 448 /** 449 * Loads a unique B bean from a template one giving a c 450 * 451 * @param bean the B bean to look for 452 * @return the bean matching the template 453 * @throws ObjectRetrievalException not found or more than one row 454 * @throws RuntimeDaoException 455 */ 456 public B loadUniqueUsingTemplateChecked(B bean)throws RuntimeDaoException,ObjectRetrievalException; 457 458 //19 459 /** 460 * Loads an array of B from a template one. 461 * 462 * @param bean the B bean template to look for 463 * @return all the B beans matching the template 464 * @throws RuntimeDaoException 465 */ 466 public B[] loadUsingTemplate(B bean)throws RuntimeDaoException; 467 468 //19-1 469 /** 470 * Loads each row from a template one and dealt with action. 471 * 472 * @param bean the B bean template to look for 473 * @param action Action object for do something(not null) 474 * @return the count dealt by action 475 * @throws RuntimeDaoException 476 */ 477 public int loadUsingTemplate(B bean,Action<B> action)throws RuntimeDaoException; 478 479 //20 480 /** 481 * Loads an array of B bean from a template one, given the start row and number of rows. 482 * 483 * @param bean the B bean template to look for 484 * @param startRow the start row to be used (first row = 1, last row=-1) 485 * @param numRows the number of rows to be retrieved (all rows = a negative number) 486 * @return all the B matching the template 487 * @throws RuntimeDaoException 488 */ 489 public B[] loadUsingTemplate(B bean, int startRow, int numRows)throws RuntimeDaoException; 490 491 //20-1 492 /** 493 * Loads each row from a template one, given the start row and number of rows and dealt with action. 494 * 495 * @param bean the B bean template to look for 496 * @param startRow the start row to be used (first row = 1, last row=-1) 497 * @param numRows the number of rows to be retrieved (all rows = a negative number) 498 * @param action Action object for do something(not null) 499 * @return the count dealt by action 500 * @throws RuntimeDaoException 501 */ 502 public int loadUsingTemplate(B bean, int startRow, int numRows,Action<B> action)throws RuntimeDaoException; 503 504 //20-5 505 /** 506 * Loads each row from a template one, given the start row and number of rows and dealt with action. 507 * 508 * @param bean the B template to look for 509 * @param fieldList table of the field's associated constants 510 * @param startRow the start row to be used (first row = 1, last row=-1) 511 * @param numRows the number of rows to be retrieved (all rows = a negative number) 512 * @param searchType exact ? like ? starting like ? ending link ? <br> 513 * {@value Constant#SEARCH_EXACT} {@link Constant#SEARCH_EXACT} <br> 514 * {@value Constant#SEARCH_LIKE} {@link Constant#SEARCH_LIKE} <br> 515 * {@value Constant#SEARCH_STARTING_LIKE} {@link Constant#SEARCH_STARTING_LIKE} <br> 516 * {@value Constant#SEARCH_ENDING_LIKE} {@link Constant#SEARCH_ENDING_LIKE} <br> 517 * @param action Action object for do something(not null) 518 * @return the count dealt by action 519 * @throws RuntimeDaoException 520 */ 521 public int loadUsingTemplate(B bean, int[] fieldList, int startRow, int numRows,int searchType, Action<B> action)throws RuntimeDaoException; 522 //20-4 523 /** 524 * Loads a list of B bean from a template one, given the start row and number of rows. 525 * 526 * @param bean the B bean template to look for 527 * @param startRow the start row to be used (first row = 1, last row=-1) 528 * @param numRows the number of rows to be retrieved (all rows = a negative number) 529 * @param searchType exact ? like ? starting like ? ending link ? <br> 530 * {@value Constant#SEARCH_EXACT} {@link Constant#SEARCH_EXACT} <br> 531 * {@value Constant#SEARCH_LIKE} {@link Constant#SEARCH_LIKE} <br> 532 * {@value Constant#SEARCH_STARTING_LIKE} {@link Constant#SEARCH_STARTING_LIKE} <br> 533 * {@value Constant#SEARCH_ENDING_LIKE} {@link Constant#SEARCH_ENDING_LIKE} <br> 534 * @return all the B bean matching the template 535 * @throws RuntimeDaoException 536 */ 537 public B[] loadUsingTemplate(B bean, int startRow, int numRows, int searchType)throws RuntimeDaoException; 538 539 //19-2 540 /** 541 * Loads a list of B bean from a template one. 542 * 543 * @param bean the B bean template to look for 544 * @return all the B beans matching the template 545 * @throws RuntimeDaoException 546 */ 547 public List<B> loadUsingTemplateAsList(B bean)throws RuntimeDaoException; 548 549 //20-2 550 /** 551 * Loads a list of B bean from a template one, given the start row and number of rows. 552 * 553 * @param bean the B bean template to look for 554 * @param startRow the start row to be used (first row = 1, last row=-1) 555 * @param numRows the number of rows to be retrieved (all rows = a negative number) 556 * @return all the B bean matching the template 557 * @throws RuntimeDaoException 558 */ 559 public List<B> loadUsingTemplateAsList(B bean, int startRow, int numRows)throws RuntimeDaoException; 560 561 //20-3 562 /** 563 * Loads an array of B bean from a template one, given the start row and number of rows. 564 * 565 * @param bean the B bean template to look for 566 * @param startRow the start row to be used (first row = 1, last row=-1) 567 * @param numRows the number of rows to be retrieved (all rows = a negative number) 568 * @param searchType exact ? like ? starting like ? ending link? <br> 569 * {@value Constant#SEARCH_EXACT} {@link Constant#SEARCH_EXACT} <br> 570 * {@value Constant#SEARCH_LIKE} {@link Constant#SEARCH_LIKE} <br> 571 * {@value Constant#SEARCH_STARTING_LIKE} {@link Constant#SEARCH_STARTING_LIKE} <br> 572 * {@value Constant#SEARCH_ENDING_LIKE} {@link Constant#SEARCH_ENDING_LIKE} <br> 573 * @return all the B beans matching the template 574 * @throws RuntimeDaoException 575 */ 576 public List<B> loadUsingTemplateAsList(B bean, int startRow, int numRows, int searchType)throws RuntimeDaoException; 577 //20-4 578 /** 579 * Retrieves each row of B bean given a SQL where clause and a list of fields, 580 * and dealt with each action. 581 * It is up to you to pass the 'WHERE' in your where clauses. 582 * @param each DoForEach object for do something(not null) 583 * @param stopOnError stop on error 584 * @param where the SQL 'where' clause, retrieves all rows if {@code null} or empty 585 * @throws RuntimeDaoException 586 */ 587 public void foreachByWhere(DoEach<B> each, boolean stopOnError, String where)throws RuntimeDaoException; 588 //20-5 589 /** 590 * Retrieves each row of B bean given a SQL where clause and a list of fields, 591 * and dealt with each action. 592 * It is up to you to pass the 'WHERE' in your where clauses. 593 * @param each DoForEach object for do something(not null) 594 * @param stopOnError stop on error 595 * @throws RuntimeDaoException 596 */ 597 public void foreach(DoEach<B> each, boolean stopOnError)throws RuntimeDaoException; 598 //_____________________________________________________________________ 599 // 600 // LISTENER 601 //_____________________________________________________________________ 602 603 //35 604 /** 605 * Registers a unique {@link TableListener} listener.<br> 606 * do nothing if {@code TableListener} instance exists 607 * @param listener 608 */ 609 public void registerListener(TableListener<B> listener); 610 611 //36 612 /** 613 * remove listener. 614 * @param listener 615 */ 616 public void unregisterListener(TableListener<B> listener); 617 618 //_____________________________________________________________________ 619 // 620 // SAVE 621 //_____________________________________________________________________ 622 //12 623 /** 624 * Saves the B bean into the database. 625 * 626 * @param bean the B bean to be saved 627 * @return the inserted or updated bean,or null if bean is null 628 * @throws RuntimeDaoException 629 */ 630 public B save(B bean)throws RuntimeDaoException; 631 632 //12-1 633 /** 634 * If the specified key is not already exist, add it to database. 635 * This is equivalent to 636 * <pre> {@code 637 * if (!existsByPrimaryKey(bean)) 638 * return insert(bean); 639 * else 640 * return loadByPrimaryKey(bean); 641 * }</pre> 642 * 643 * except that the action is performed atomically . 644 * @param bean the B bean to be saved 645 * @return the previous value exists in database, or saved bean if not exists bean , 646 * or {@code null} if bean is {@code null} 647 * @throws RuntimeDaoException 648 */ 649 public B addIfAbsent(B bean) throws RuntimeDaoException; 650 //15 651 /** 652 * Saves an array of B bean into the database. 653 * 654 * @param beans the array of B bean to be saved 655 * @return always beans saved 656 * @throws RuntimeDaoException 657 */ 658 public B[] save(B[] beans)throws RuntimeDaoException; 659 660 //15-2 661 /** 662 * Saves a collection of B bean into the database. 663 * 664 * @param beans the B bean table to be saved 665 * @return alwarys beans saved 666 * @throws RuntimeDaoException 667 */ 668 public <C extends Collection<B>> C saveAsTransaction(C beans)throws RuntimeDaoException; 669 670 //15-3 671 /** 672 * Saves an array of B bean into the database as transaction. 673 * 674 * @param beans the B bean table to be saved 675 * @return alwarys beans saved 676 * @see #save(BaseBean[]) 677 * @throws RuntimeDaoException 678 */ 679 public B[] saveAsTransaction(B[] beans)throws RuntimeDaoException; 680 681 //15-4 682 /** 683 * Saves a collection of B bean into the database as transaction. 684 * 685 * @param beans the B bean table to be saved 686 * @return alwarys beans saved 687 * @throws RuntimeDaoException 688 */ 689 public <C extends Collection<B>> C save(C beans)throws RuntimeDaoException; 690 691 /** 692 * Load column from table. 693 * @param column column name or java file name of B 694 * @param distinct select distinct values 695 * @param where the sql 'where' clause 696 * @param startRow the start row to be used (first row = 1, last row = -1) 697 * @param numRows the number of rows to be retrieved (all rows = a negative number) 698 * @return an list of column 699 * @throws RuntimeDaoException 700 */ 701 public <T>List<T> loadColumnAsList(String column,boolean distinct,String where,int startRow,int numRows)throws RuntimeDaoException; 702 703}