提交 d22a1a41 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improve docs

上级 8ec01485
......@@ -50,7 +50,7 @@ http://www.h2database.com/html/roadmap.html
<p>
The development of H2 was started in May 2004,
but it was first published on December 14th 2005.
The author of H2, Thomas Mueller, is also the original developer of Hypersonic SQL.
The main author of H2, Thomas Mueller, is also the original developer of Hypersonic SQL.
In 2001, he joined PointBase Inc. where he created PointBase Micro.
At that point, he had to discontinue Hypersonic SQL, but then the HSQLDB Group was formed
to continued to work on the Hypersonic SQL codebase.
......
......@@ -21,7 +21,7 @@ JaQu
<p>
JaQu stands for Java Query and allows to access databases using pure Java.
JaQu provides a fluent interface (or internal DSL) for building SQL statements.
JaQu replaces SQL, JDBC, and object/relation frameworks such as Hibernate.
JaQu replaces SQL, JDBC, and persistence frameworks such as Hibernate.
JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a
Microsoft .NET technology). The following JaQu code:
</p>
......@@ -38,14 +38,14 @@ SELECT * FROM PRODUCTS P
WHERE P.UNITS_IN_STOCK = 0
</pre>
<h2>Advantages and Differences to other Data Access Tools</h2>
<h2>Advantages and Differences to Other Data Access Tools</h2>
<p>
Unlike SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java,
Javadoc and auto-complete are supported. Type checking is performed by the compiler.
auto-complete in the IDE and Javadoc and are supported. Type checking is performed by the compiler.
JaQu fully protects against SQL injection.
</p>
<p>
JaQu is much smaller than object/relation mapping tools such as Hibernate.
JaQu is much smaller than persistence frameworks such as Hibernate.
Unlike iBatis and Hibernate, no XML or annotation based configuration is required;
instead the configuration (if required at all) is done in pure Java, in the application itself.
</p>
......@@ -56,15 +56,14 @@ JaQu provides full control over when and what SQL statements are executed.
<h3>Restrictions</h3>
<p>
Primitive types (eg. boolean, int, long, double) are not supported. Instead,
Boolean, Integer, Long, and Double must be used.
Primitive types (eg. boolean, int, long, double) are not supported. Use
Boolean, Integer, Long, and Double instead.
</p>
<h3>Why in Java?</h3>
<p>
Most people use Java in their application. Mixing Java and another language (for example Scala or Groovy)
in the same application is complicated. It would be required to split the code to access the database
and the application code.
in the same application is complicated: You would need to split the application and database code.
</p>
<h2>Current State</h2>
......@@ -162,7 +161,7 @@ public class Test {
final Product p = new Product();
List&lt;ProductPrice> productInfos =
db.from(p).orderBy(p.productId).
select(new ProductPrice() { {
select(new ProductPrice() {{
productName = p.productName;
category = p.category;
price = p.unitPrice;
......@@ -183,7 +182,7 @@ public class Test {
innerJoin(o).on(c.customerId).is(o.customerId).
where(o.total).smaller(new BigDecimal("500.00")).
orderBy(1).
select(new CustOrder() { {
select(new CustOrder() {{
customerId = c.customerId;
orderId = o.orderId;
total = o.total;
......@@ -192,7 +191,8 @@ public class Test {
private void testLength() throws Exception {
Product p = new Product();
List&lt;Integer> lengths = db.from(p).
List&lt;Integer> lengths =
db.from(p).
where(length(p.productName)).smaller(10).
orderBy(1).
selectDistinct(length(p.productName));
......@@ -213,7 +213,7 @@ public class Test {
db.from(p).
groupBy(p.category).
orderBy(1).
select(new ProductGroup() { {
select(new ProductGroup() {{
category = p.category;
productCount = count();
}});
......@@ -224,7 +224,7 @@ public class Test {
<h2>Configuration</h2>
<p>
JaQu does not require any kind of configuration is you want to use the default mapping.
JaQu does not require any configuration when using the default mapping.
To define table indices, or if you want to map a class to a table with a different name,
or a field to a column with another name, create a function called 'define' in the data class.
Example:
......@@ -243,22 +243,23 @@ public class Product implements Table {
primaryKey(productId);
index(productName, category);
}
}
</pre>
<p>
The method 'define()' contains the mapping definition. It is called once
when the class is used for the first time. Like annotations, the mapping is defined in the class itself.
Unlike when using annotations, the compiler can check the syntax even for multi-column
objects (multi-column indexes, multi-column primary keys and so on).
This solution is very flexible because the definition is written in regular Java code:
Unlike when using annotations, your code can select the right configuration depending
on the environment if required. Unlike XML mapping configuration, the configuration
is integrated in the class itself.
Because the definition is written in regular Java, the configuration can depend on the environment.
This is not possible using annotations.
Unlike XML mapping configuration, the configuration is integrated in the class itself.
</p>
<h2>Ideas</h2>
<p>
This project has just been started, and nothing is fixed yet.
Some ideas for what to implement include:
Some ideas for what to implement are:
</p>
<ul><li>Support queries on collections (instead of using a database).
</li><li>Provide API level compatibility with JPA (so that JaQu can be used as an extension of JPA).
......
......@@ -35,9 +35,9 @@ There is a License FAQ for both the MPL and the EPL, most of that is applicable
<p>
However, nobody is allowed to rename H2, modify it a little, and sell it as a database engine without telling the customers it is in fact H2.
This happened to HSQLDB, when a company called 'bungisoft' copied HSQLDB, renamed it to 'RedBase', and tried to sell it,
hiding the fact that it was, in fact, just HSQLDB. At this time, it seems 'bungisoft' does not exist any more, but you can use the
Wayback Machine of http://www.archive.org and look for old web pages of http://www.bungisoft.com .
This happened to HSQLDB: A company called 'bungisoft' copied HSQLDB, renamed it to 'RedBase', and tried to sell it,
hiding the fact that it was in fact just HSQLDB. It seems 'bungisoft' does not exist any more, but you can use the
Wayback Machine of http://www.archive.org and visit old web pages of http://www.bungisoft.com .
</p><p>
About porting the source code to another language (for example C# or C++): Converted source code (even if done manually) stays under the same
copyright and license as the original code. The copyright of the ported source code does not (automatically) go to the person who ported the code.
......@@ -466,8 +466,8 @@ described in <a href="#exhibit-a">Exhibit A</a>.
<h3 id="exhibit-a">Exhibit A</h3>
<pre>
Multiple-Licensed under the H2 License,
Version 1.0, and under the Eclipse Public License, Version 1.0
Multiple-Licensed under the H2 License, Version 1.0,
and under the Eclipse Public License, Version 1.0
(http://h2database.com/html/license.html).
Initial Developer: H2 Group
</pre>
......
......@@ -221,7 +221,7 @@ Java job scheduler, file transfer, workflow, and BPM.
<p><a href="http://ggc.sourceforge.net">
GNU Gluco Control</a><br />
Helps you to manage your diabetes..
Helps you to manage your diabetes.
</p>
<p><a href="http://www.goldenstudios.or.id">
......@@ -409,6 +409,11 @@ OpenGroove</a><br />
OpenGroove is a groupware program that allows users to synchronize data.
</p>
<p><a href="http://code.google.com/p/opensocial-development-environment">
OpenSocial Development Environment (OSDE)</a><br />
Development tool for OpenSocial application.
</p>
<p><a href="http://www.orionserver.com">
Orion</a><br />
J2EE Application Server.
......
......@@ -17,7 +17,7 @@ H2 Database Engine
<h1>H2 Database Engine</h1>
<p>
Welcome to H2, the free SQL database engine.
Welcome to H2, the free Java SQL database engine.
</p>
<br />
......
......@@ -22,8 +22,8 @@ H2 Database Engine
Welcome to H2, the Java SQL database. The main feature of H2 are:
</p>
<ul>
<li>Very fast, open source, JDBC and ODBC API
</li><li>Embedded, server and cluster modes; in-memory databases
<li>Very fast, open source, JDBC API
</li><li>Embedded and server modes; in-memory databases
</li><li>Browser based Console application
</li><li>Small footprint: around 1 MB jar file size
</li></ul>
......
......@@ -30,7 +30,7 @@ Performance
<br /><a name="performance_comparison"></a>
<h2>Performance Comparison</h2>
<p>
In most cases H2 is a lot faster than all other
In many cases H2 is a lot faster than other
(open source and not open source) database engines.
Please note this is mostly a single connection benchmark run on one computer.
</p>
......@@ -93,7 +93,7 @@ One situation where is H2 is slow is large result sets, because they are buffere
disk if more than a certain number of records are returned.
The advantage of buffering is, there is no limit on the result set size.
The open/close time is almost fixed, because of the file locking protocol: The engine waits
20 ms after opening a database to ensure the database files are not opened by another process.
some time after opening a database to ensure the database files are not opened by another process.
</p>
<h4>HSQLDB</h4>
......@@ -112,15 +112,15 @@ AND S_W_ID=? AND S_I_ID=OL_I_ID AND S_QUANTITY&lt;?
</pre>
<p>
The PolePosition benchmark also shows that the query optimizer does not do a very good job for some queries.
A disadvantage in HSQLDB is the slow startup / shutdown time (currently not listed) when using bigger databases.
The reason is, a backup of the database is created whenever the database is opened or closed.
Another disadvantage of HSQLDB is the slow startup / shutdown time (currently not listed) when using bigger databases.
The reason is, a backup of the whole data is made whenever the database is opened or closed.
</p>
<h4>Derby</h4>
<p>
Version 10.4.2.0 was used for the test. Derby is clearly the slowest embedded database in this test.
This seems to be a structural problem, because all operations are really slow.
It will not be easy for the developers of Derby to improve the performance to a reasonable level.
It will be hard for the developers of Derby to improve the performance to a reasonable level.
A few problems have been identified: Leaving autocommit on is a problem for Derby.
If it is switched off during the whole test, the results are about 20% better for Derby.
Derby supports a testing mode (system property derby.system.durability=test) where durability is
......@@ -190,7 +190,7 @@ BenchC is similar to the TPC-C test, but single connection / single threaded.
<h4>Comparing Embedded with Server Databases</h4>
<p>
This is mainly a benchmark for embedded databases (where the application runs in the same
virtual machine than the database engine). However MySQL and PostgreSQL are not Java
virtual machine as the database engine). However MySQL and PostgreSQL are not Java
databases and cannot be embedded into a Java application.
For the Java databases, both embedded and server modes are tested.
</p>
......@@ -212,8 +212,7 @@ This benchmark runs three times, but only the last run is measured.
<h4>Memory Usage</h4>
<p>
It is not enough to measure the time taken, the memory usage is important as well.
Performance can be improved in databases by using a bigger in-memory cache,
but there is only a limited amount of memory available on the system.
Performance can be improved by using a bigger cache, but the amount of memory is limited.
HSQLDB tables are kept fully in memory by default; this benchmark
uses 'disk based' tables for all databases.
Unfortunately, it is not so easy to calculate the memory usage of PostgreSQL
......@@ -254,8 +253,6 @@ This time is not measured currently.
Also, not tested is the time used to create a database and open an existing database.
Here, one (wrapper) connection is opened at the start,
and for each step a new connection is opened and then closed.
That means the Open/Close time listed is for opening a connection
if the database is already in use.
</p>
<br /><a name="poleposition_benchmark"></a>
......
......@@ -408,6 +408,7 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>MySQL compatibility: DELETE .. FROM .. USING - See http://dev.mysql.com/doc/refman/5.0/en/delete.html
</li><li>Allow to scan index backwards starting with a value (to better support ORDER BY DESC).
</li><li>Java Service Wrapper: try http://yajsw.sourceforge.net/
</li><li>Batch parameter for INSERT, UPDATE, and DELETE, and commit after each batch. See also MySQL DELETE.
</li></ul>
<h2>Not Planned</h2>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论