Hibernate及Spring quartz開發中幾個注意點

由Hibernate取得的多字段List類型按一下方法讀出:

            List countStatus=asDao.getCountOfStatus();

            Iterator it = countStatus.iterator();           

            while (it.hasNext()) {
                Object[] cStatus = (Object[]) it.next();
                System.out.println(cStatus[0].toString());

                ....
            }

 

Spring中用到quartz插件配置的含義如下:

Field Name Mandatory Allowed Values Allowed Special Characters
Seconds YES 0-59 , - * /
Minutes YES 0-59 , - * /
Hours YES 0-23 , - * /
Day of month YES 1-31 , - * ? / L W
Month YES 1-12 or JAN-DEC , - * /
Day of week YES 1-7 or SUN-SAT , - * ? / L #
Year NO empty, 1970-2099

, - * /

 

參數可以由六個參數或其各參數組成,其中對?和*的解釋如下:

 

  • * ("all values" ) - used to select all values within a field. For example, "*" in the minute field means "every minute" .
  • * 所有值,用來選擇這個字段內的所有值,例如,在分鐘內的*表示每一分鐘。
  • ? ("no specific value" ) - useful when you need to specify something in one of the two fields in which the character is allowed, but not the other. For example, if I want my trigger to fire on a particular day of the month (say, the 10th), but don't care what day of the week that happens to be, I would put "10" in the day-of-month field, and "?" in the day-of-week field. See the examples below for clarification.
  • ? 沒有具體的值,用來在你需要確定兩個字段值中的一個時。例如,如果我想觸發一個月中的特定一天(10日), 但是不論是一個星期中的哪一天,我就會在day-of-month字段放上10,在day-of-week字段放上問號。(簡而言之,*和?用來解決day-of-week和day-of-month在設定上的衝突,這兩個字段不能同時出現*)

Examples

Here are some full examples:

Expression Meaning
0 0 12 * * ? Fire at 12pm (noon) every day
0 15 10 ? * * Fire at 10:15am every day
0 15 10 * * ? Fire at 10:15am every day
0 15 10 * * ? * Fire at 10:15am every day
0 15 10 * * ? 2005 Fire at 10:15am every day during the year 2005
0 * 14 * * ? Fire every minute starting at 2pm and ending at 2:59pm, every day
0 0/5 14 * * ? Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day
0 0/5 14,18 * * ? Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day
0 0-5 14 * * ? Fire every minute starting at 2pm and ending at 2:05pm, every day
0 10,44 14 ? 3 WED Fire at 2:10pm and at 2:44pm every Wednesday in the month of March.
0 15 10 ? * MON-FRI Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday
0 15 10 15 * ? Fire at 10:15am on the 15th day of every month
0 15 10 L * ? Fire at 10:15am on the last day of every month
0 15 10 ? * 6L Fire at 10:15am on the last Friday of every month
0 15 10 ? * 6L Fire at 10:15am on the last Friday of every month
0 15 10 ? * 6L 2002-2005 Fire at 10:15am on every last friday of every month during the years 2002, 2003, 2004 and 2005
0 15 10 ? * 6#3 Fire at 10:15am on the third Friday of every month
0 0 12 1/5 * ? Fire at 12pm (noon) every 5 days every month, starting on the first day of the month.
0 11 11 11 11 ? Fire every November 11th at 11:11am.

 

 

發佈了38 篇原創文章 · 獲贊 1 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章