1. WHERE對返回的
行進行過濾
2. GROUP BY對保留的行進行分組
3. HAVING對
分組進行過濾

子查詢不能包含ORDER BY

雙引號直接用:'The "Great" Gatsby' (表示字符串 The "Great" Gatsby )
單引號要轉(zhuǎn)義:'O''Malley' (表示字符串 O'Malley )

?DML
select column1,column2 from table
insert into table(column1,column2) value
s('a','b')
update table set column1='a' where column2='b'
delete from table where column1='a'

--外連接,使用叉積表達有歧義,不運行:查詢中包含不允許的外聯(lián)接請求。
select * from a,b,c
??????? where a.a_id*=b.a_id
??????????? and b.b_id*=c.b_id
--這樣就不存在歧義性了
select * from a
??? LEFT OUTER JOIN b on (a.a_id=b.a_id)
??? LEFT OUTER JOIN c on (b.b_id=c.b_id)
posted @
2006-08-23 08:36 Jcat 閱讀(408) |
評論 (1) |
編輯 收藏
Pseudo columns
A pseudo column is an item of data which does not belong in any particular table but which can be treated as if it did. Any SELECT list of columns can include these pseudo columns.
SYSDATE current date and time
ROWNUM sequence number assigned to retrieved rows
ROWID unique identifier for a row
UID number associated with a user
USER userid of current user
The DUAL table
ORACLE provides a "dummy" table called DUAL containing one column and one row. It is useful for selecting miscellaneous information from ORACLE.
Some uses for DUAL
posted @
2006-08-18 08:50 Jcat 閱讀(235) |
評論 (0) |
編輯 收藏
http://www.oracle.com/pls/db102/portal.portal_db?selected=3#index-SQL
Basical
?
Concepts -> Administrator's Guide -> SQL Reference
Advanced?
PL/SQL User's Guide and Reference
SQL*Plus User's Guide and Reference
Reference
Application Developer's Guide – Fundamentals
Backup and Recovery Advanced User's Guide
Backup and Recovery Basics
Backup and Recovery Reference
?
posted @
2006-08-12 17:03 Jcat 閱讀(195) |
評論 (0) |
編輯 收藏
吉祥三寶
http://struts.apache.org/
http://www.springframework.org/
http://www.hibernate.org/
Apache
http://ant.apache.org/
Apache Ant is a Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles.
http://lucene.apache.org/
Apache
Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform.
http://jakarta.apache.org/commons/index.htmlThe
Commons is a Jakarta subproject focused on all aspects of reusable Java components.
http://jakarta.apache.org/velocity/index.htmlVelocity is a Java-based template engine. It permits anyone to use a simple yet powerful template language to reference objects defined in Java code.
Sourceforgehttp://junit.sourceforge.net/JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.
http://httpunit.sourceforge.net/HttpUnit makes you easy? to be able to bypass the browser and access your site from a program. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.
http://dozer.sourceforge.net/
Dozer is a powerful, yet simple Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.
http://xdoclet.sourceforge.net/xdoclet/index.htmlXDoclet is an open source code generation engine. It enables Attribute-Oriented Programming for java. In short, this means that you can add more significance to your code by adding meta data (attributes) to your java sources. This is done in special JavaDoc tags.
http://displaytag.sourceforge.netThe
display tag library is an open source suite of custom tags that provide high-level web presentation patterns which will work in an MVC model. Actually the display tag library can just... display tables! Give it a list of objects and it will handle column display, sorting, paging, cropping, grouping, exporting, smart linking and decoration of a table in a customizable XHTML style.
http://cglib.sourceforge.net/cglib is a powerful, high performance and quality Code Generation Library, It is used to extend JAVA classes and implements interfaces at runtime.
Othershttp://www.opensymphony.com/compass/Compass is a first class open source Java Search Engine Framework, enabling the power of Search Engine semantics to your application stack decoratively. Built on top of the amazing Lucene Search Engine, Compass integrates seamlessly to popular development frameworks like Hibernate and Spring.
http://www.opensymphony.com/quartz/Quartz is a full-featured, open source job scheduling system that can be integrated with, or used along side virtually any J2EE or J2SE application - from the smallest stand-alone application to the largest e-commerce system.
http://groovy.codehaus.org/Groovy is an agile dynamic language for?the Java Platform with many features that are inspired by languages like Python, Ruby and Smalltalk, making them available to Java developers using a Java-like syntax.
http://www.singularsys.com/jep/
JEP is a Java library for parsing and evaluating mathematical expressions. With this package you can allow your users to enter an arbitrary formula as a string, and instantly evaluate it. JEP supports user defined variables, constants, and functions. A number of common mathematical functions and constants are included.
http://www.dom4j.org/
dom4j is an easy to use, open source library for working with XML, XPath and XSLT on the Java platform using the Java Collections Framework and with full support for DOM, SAX and JAXP.
http://www.castor.org/Castor is an Open Source data binding framework for Java. It's the shortest path between Java objects, XML documents and relational tables. Castor provides Java-to-XML binding, Java-to-SQL persistence, and more.
posted @
2006-08-12 15:28 Jcat 閱讀(369) |
評論 (0) |
編輯 收藏
單行注釋: ##your note
多行注釋: #*your note*#
不能直接訪問對象的域,只能通過方法來訪問。關(guān)于方法的調(diào)用,有兩種變體(Velocity會幫你調(diào)用相應的方法):
1)對于context中的Hashtable對象,可以直接用$hashtable.key來得到value,相當于$hashtable.get(key)
2)對于context中的JavaBean對象,可以直接用$javaBean.property來訪問,相當于$javaBean.getProperty()
安靜引用符(Quiet Reference Notation)$!
作用:當引用的變量為null時,將輸出空字符串。(如果用$xxx,當null時,會輸出字符串"$xxx")
雙引號中的$xxx將仍然被解析;單引號中的$xxx將不被解析,輸出字符串"$xxx"
關(guān)于路徑:
1. 為VelocityEngine指定velocityLoaderPath,該路徑為存放vm文件的根目錄(其下可以建子文件夾,無需另外指定)
2. 對vm的引用都是以velocityLoaderPath開始的絕對路徑。比如:
?|-velocityLoaderPath
???|-a.vm
???|-B
?????|-b.vm在b.vm中引用a.vm:#parse("a.vm") 正確;? #parse("../a.vm") 錯誤
posted @
2006-08-08 08:21 Jcat 閱讀(389) |
評論 (0) |
編輯 收藏
最后的逗號
String[] strs = {"1", "2", "3", };
System.out.println(strs.length); //3
這竟然是符合語法的!
ArrayInitializer:???????
{ [VariableInitializer {, VariableInitializer} [,]] }
VariableInitializer:?ArrayInitializer?Expression
http://java.sun.com/docs/books/jls/third_edition/html/syntax.html#18.1
"This is good for quick testing. I always use this. In my case, I have a table, sometimes I care some columns, other times I care some other columns, so I am lazy to remove the last comma when I change columns. It's convenient."
運行沒有main的java類
??????通常我們需要在java類中添加main函數(shù)才能在命令行運行這個類,但是有一種(可以讓你暈死的)方法可以讓你在沒有main的情況下也可以運行java class(當然不是用applet),代碼如下:
public
?
class
?NoMainMethod

{
????
static
{
????????System.out.println(
"
Hello?word,?no?main?method!
"
);
????????System.exit(
0
);
????}
}
??????static語句塊會在加載類的時候加載,它在main函數(shù)之前運行。 當static語句塊運行完畢后,會尋找main函數(shù),如果沒有找到,就會拋出異常。但是在以上的代碼中,static語句塊執(zhí)行后,我們終止程序的運行,所以異常就不會被拋出啦。
跳出JavaBean的命名規(guī)范
??????通常,JavaBean的命名規(guī)范為:屬性名的第二個字母也不能大寫。即不可以出現(xiàn)類似 aAndB 這樣的屬性名。如,Hibernate的PO如果出現(xiàn)這樣的名字,將拋出net.sf.hibernate.PropertyNotFoundException異常。但是有一個辦法可以解決該問題:
java?file:?????
private
?String?aAndB;???

public
?String?getAAndB()?
{????????
????????
return
?aAndB;???
}
???

public
?
void
?setAAndB(String?aAndB)?
{???????
???????? this
.aAndB?
=
?aAndB;???
}
mapping.xml
<
property?
name
="AAndB"
?column
="a_and_b"
/>
??????結(jié)研究發(fā)現(xiàn),上述辦法可以成功的將aAndB這樣的屬性與數(shù)據(jù)庫mapping起來。
??????顯然hibernate是通過setter和getter來訪問對象的屬性的,所以我們可以說:mapping.xml并不是在類的屬性和數(shù)據(jù)庫的字段名之間做映射,而是在setter/getter和數(shù)據(jù)庫的字段之間做映射。
??????誠然,即使可以也別這么干,實際工作中,還是規(guī)避這種問題的好。?
posted @
2006-08-06 00:27 Jcat 閱讀(271) |
評論 (0) |
編輯 收藏
posted @
2006-08-03 18:43 Jcat 閱讀(340) |
評論 (0) |
編輯 收藏
Languages
Java: SCJP1.5 (Just for interesting, waiting for a good book about 1.5)
English: Java is our father, while English is our mother!
XML: XML schema vs DTD
SQL: PL/SQL
UML
HTML + JS + CSS (Just a little)
Java Frame Work
Junit vs TestNG
Ant
Struts + Spring + Hibernate
Lucene + Compass
?
Tools
IntelliJ: Keymap practice and Plugin investigation
Oracle 10g: To be a OCA at first
PowerDesigner
Tomcat vs ???
Postgre
Linux: Very important, but I?have no any other time in faith.
Others
7habits: To be a habit, but time is also a big problem
Design Pattern: To read gof's book.
AJAX
AOP
J2ME
posted @
2006-07-31 22:44 Jcat 閱讀(302) |
評論 (0) |
編輯 收藏
癥

狀:剛配置好struts,可是DispatchAction怎么都不工作(Action可以工作),也不報錯
原因:只引入了struts自身的jar,看一看release中l(wèi)ib下,還有不少非struts的jar,可以猜想這些都是DispatchAction所需要的,而Action不需要(以前以為這些沒用)。不報錯讓我很郁悶。
癥

狀:剛配置好struts,action可以工作了,就是不能正確的forward到jsp頁面,execute中加斷點,也不進入。
原因:execute有兩個!!!
HttpServletRequest vs ServletRequest,前者才是struts所使用的execute。
癥

狀:在web.xml里面設置好了
<error-page>
????????<error-code>404</error-code>
????????<location>/404.jsp</location>
</error-page>但當出現(xiàn)
404錯誤時,并沒有顯示404.jsp這一頁,而是顯示browser提供的error report page
原因:在客戶端瀏覽器如IE的internet選項高級屬性中默認使用“友好的http錯誤信息”,這樣會造成你的服務器是輸出你所定義的錯誤頁面,但到客戶端被IE這混蛋給覆蓋掉了。解決方案是你定義的錯誤頁面的大小必須大于
512bytes,就不會被客戶端設置所影響了。
癥

狀:用hibernate訪問數(shù)據(jù)庫,可以insert,可以select,可以drop,就是不能
update,而且沒有任何錯誤消息
原因:
<class name="com.verican.base.model.CatalogPO" table="sys_catalog" mutable="
false">設置成
true即可。
(當mutable=false,卻又執(zhí)行update操作時,hibernate至少應該提供警告消息告知一下才對,可惜沒有,所以很難發(fā)現(xiàn))
癥

狀:
??????Javascript彈出窗口時,如果用的是相對路徑,形如javascript:void(window.open('
../../test.html')),不同的瀏覽器的處理不同(因為js是瀏覽器處理的東西)。
??????比如,不是部署在根目錄下時(根目錄下又建了一個目錄):在Firefox下,是以服務器為視角,則
../../即可;而在IE下,則是以瀏覽器為視角,則需要多加一級,如
../../../。
????????????
解決:用絕對路徑 javascript:void(window.open('http://www.verican.com/test.html'));或者,用 <a
target="_blank" href="../../test.html"> (因為這是服務器處理的東西,所以不管部署在哪里,相對路徑都是唯一確定的)
癥

狀:
刷新的時候 1)拋出ServletException
?????????????????????2)The page cannot be refreshed without resending the information, Click Retry to send the information again.
原因:Struts中redirect設置問題(具體原理以后再研究)
解決:一般的,forward到一個具體的page,redirect=false;forward到另一個action,redirect=true
???????????
<forward?name="add_item"?path="newsletter.add_item.page"?redirect="false"/>
<forward?name="success"?path="/newsletter.do"?redirect="true"/>癥

狀:
save a form --> forward to list page --> refresh --> retry --> save the form again (error)
原因:
<forward?name="list"?path="ticket.list.page"?redirect="false"/>解決:一般的,從save一個表單后,應該forward到另一個action,且redirect=true(而不是另一個page,即便當前action里有這個page)。這樣可以保證不會通過刷新重復save數(shù)據(jù)。
<forward?name="list"?path="ticket.do"?redirect="true"/>癥

狀:
??????用Spring + Velocity發(fā)email,開始都好好的,也能現(xiàn)實圖片,但當加入某一幅圖片以后,無法正常顯示(得到一個頁面為空白的Email,雖然也有大小)。把圖片從bmp換到jpg,再換到gif,未果。減小圖片的尺寸、大小,未果。幾乎都要絕望了~~~
原因:
NOTE: Invoke addInline after setText; else, mail readers might not be able to resolve inline references correctly.(這是Spring API里的原話,NND)
感受:
??????1.以前沒寫過發(fā)Email的程序,工作中用到了,照貓畫虎拿過來就用,也沒有仔細閱讀文檔,導致這次慘痛的教訓。
????? 2.Spring中這部分設計的也有問題,它在兩個表面上沒什么關(guān)系的方法之間,建立了順序上的依賴關(guān)系。這使得出現(xiàn)這種情況時,沒有任何線索。
癥
狀:
遍歷List時,一調(diào)用remove就出錯,(錯誤的)代碼如下
for?(Object?o?:?list)

????{
????????????list.remove(o);
????????}原因:ConcurrentModificationException,有remove操作時,不能用foreach循環(huán)
解決:用傳統(tǒng)循環(huán)(看了傳統(tǒng)還是很有用的)
for?(int?i?=?0;?i?<?list.size();?i++)

????{
????????????list.remove(i--);
????????}
注意remove過
后需要
i--? (--i is wrong)
癥
狀:
boolean?b?=?new?Integer(3)?==?new?Integer(3);?//false原因:其實是很簡單的問題,但是IDEA只會對String的 = = 做智能提示,注意即可。
癥

狀:
org.hibernate.MappingException: Could not read mappings from resource: jcat/learn/mapping.xml
?
開始以為路徑?jīng)]寫對,試驗了N中路徑的寫發(fā)后,還是不行。后來才發(fā)現(xiàn)是因為mapping.xml是空的。
?
解決:給mapping.xml加上一個空殼就可以了(好歹空殼不等于空)
?
<?xml?version="1.0"?encoding="gb2312"?>
<!DOCTYPE?hibernate-mapping?SYSTEM?"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"?>

<hibernate-mapping?default-lazy="false">

</hibernate-mapping>?
2.
packagename/filename例子:在hibernate.cfg.xml中注冊mapping.xml
<mapping?resource="jcat/learn/hibernate_in_spring/orm.xml"/>癥

狀:提交表單程序,加入了上傳文件的功能后,出現(xiàn)異常
java.lang.IllegalArgumentException: Cannot invoke com.verican.newsadmin.form.TicketForm.setUploadFile -
argument type mismatch
解決:將表單聲明為mulptipart類型
<html:form?action="/ticket"?enctype="multipart/form-data">
?????????<html:file?property="uploadFile"/>
</html:form>癥

狀:IE cannot open the Internet site file: ....
<html>
<head>
????<title></title>
</head>
<body>
????<span?id="TypeDes2"/>

????<script?type="text/javascript">
???????TypeDes2.innerHTML?=?"Test?Span";
????</script>
</body>
</html>解決:對于單標簽,瀏覽器找不到innerHTML屬性。改為雙標簽即可。
<span?id="TypeDes2"></span>
posted @
2006-07-25 13:11 Jcat 閱讀(771) |
評論 (0) |
編輯 收藏
physical disk, physical memory
a?time-consuming operation
并,共,多
concurrent
shared
simultaneous
synchronize
multiprocess
distributed processing
posted @
2006-07-15 21:52 Jcat 閱讀(291) |
評論 (0) |
編輯 收藏