diff --git a/documentation/manual/src/main/docbook/en-US/content/architecture.xml b/documentation/manual/src/main/docbook/en-US/content/architecture.xml index cdc5ef7642..d1bca3e647 100644 --- a/documentation/manual/src/main/docbook/en-US/content/architecture.xml +++ b/documentation/manual/src/main/docbook/en-US/content/architecture.xml @@ -215,7 +215,7 @@ The instance was once associated with a persistence context, but that context was closed, or the instance was serialized to another process. It has a persistent - identity and, perhaps, a corrsponding row in the database. + identity and, perhaps, a corresponding row in the database. For detached instances, Hibernate makes no guarantees about the relationship between persistent identity and Java identity. @@ -348,7 +348,7 @@ The first two implementations provide a "one session - one database transaction" programming model, also known and used as session-per-request. The beginning and end of a Hibernate session is defined by the duration of a database transaction. - If you use programatic transaction demarcation in plain JSE without JTA, you are adviced to + If you use programmatic transaction demarcation in plain JSE without JTA, you are advised to use the Hibernate Transaction API to hide the underlying transaction system from your code. If you use JTA, use the JTA interfaces to demarcate transactions. If you execute in an EJB container that supports CMT, transaction boundaries are defined declaratively diff --git a/documentation/manual/src/main/docbook/en-US/content/performance.xml b/documentation/manual/src/main/docbook/en-US/content/performance.xml index 8a539f7b29..90d98233a6 100644 --- a/documentation/manual/src/main/docbook/en-US/content/performance.xml +++ b/documentation/manual/src/main/docbook/en-US/content/performance.xml @@ -522,7 +522,7 @@ Cat fritz = (Cat) iter.next();]]> You may also enable batch fetching of collections. For example, if each Person has a lazy collection of Cats, and 10 persons are currently loaded in the - Sesssion, iterating through all persons will generate 10 SELECTs, + Session, iterating through all persons will generate 10 SELECTs, one for every call to getCats(). If you enable batch fetching for the cats collection in the mapping of Person, Hibernate can pre-fetch collections: @@ -615,7 +615,7 @@ Cat fritz = (Cat) iter.next();]]> A different (better?) way to avoid unnecessary column reads, at least for read-only transactions is to use the projection features of HQL or Criteria queries. This avoids the need for buildtime bytecode processing and is - certainly a prefered solution. + certainly a preferred solution. @@ -760,7 +760,7 @@ Cat fritz = (Cat) iter.next();]]> - Alternatively (preferrably?), you may specify <class-cache> and + Alternatively (preferably?), you may specify <class-cache> and <collection-cache> elements in hibernate.cfg.xml. @@ -1124,7 +1124,7 @@ hibernate.cache.use_structured_entries true]]> Sets have a primary key consisting of <key> and element columns. This may be less efficient for some types of collection element, particularly composite elements or large text or binary fields; the database may not be able to index - a complex primary key as efficently. On the other hand, for one to many or many to many + a complex primary key as efficiently. On the other hand, for one to many or many to many associations, particularly in the case of synthetic identifiers, it is likely to be just as efficient. (Side-note: if you want SchemaExport to actually create the primary key of a <set> for you, you must declare all columns @@ -1330,7 +1330,7 @@ server.registerMBean(stats, on); // Register the MBean on the server]]> - Statistics can be reset programatically using the clear() method. + Statistics can be reset programmatically using the clear() method. A summary can be sent to a logger (info level) using the logSummary() method. @@ -1367,7 +1367,7 @@ server.registerMBean(stats, on); // Register the MBean on the server]]> - For exampl,e you can check the cache hit, miss, and put ratio of entities, collections + For example, you can check the cache hit, miss, and put ratio of entities, collections and queries, and the average time a query needs. Beware that the number of milliseconds is subject to approximation in Java. Hibernate is tied to the JVM precision, on some platforms this might even only be accurate to 10 seconds. diff --git a/documentation/manual/src/main/docbook/en-US/content/query_sql.xml b/documentation/manual/src/main/docbook/en-US/content/query_sql.xml index 0a381cd2c7..f02a4e38a5 100644 --- a/documentation/manual/src/main/docbook/en-US/content/query_sql.xml +++ b/documentation/manual/src/main/docbook/en-US/content/query_sql.xml @@ -59,7 +59,7 @@ sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE FROM CATS").list(); This will still return Object arrays, but now it will not use - ResultSetMetdata but will instead explicitly get the + ResultSetMetadata but will instead explicitly get the ID, NAME and BIRTHDATE column as respectively a Long, String and a Short from the underlying resultset. This also means that only these three columns will be returned, even though the query is using @@ -181,7 +181,7 @@ sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE FROM CATS").addEntity(Cat.class) row, a cat and its mother. This will fail since there is a conflict of names since they are mapped to the same column names and on some databases the returned column aliases will most likely be on the form - "c.ID", "c.NAME", etc. which are not equal to the columns specificed in + "c.ID", "c.NAME", etc. which are not equal to the columns specified in the mappings ("ID" and "NAME"). The following form is not vulnerable to column name @@ -206,7 +206,7 @@ sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE FROM CATS").addEntity(Cat.class) The {cat.*} and {mother.*} notation used above is a shorthand for - "all properties". Alternatively, you may list the columns explicity, but + "all properties". Alternatively, you may list the columns explicitly, but even in this case we let Hibernate inject the SQL column aliases for each property. The placeholder for a column alias is just the property name qualified by the table alias. In the following example, we retrieve @@ -450,7 +450,7 @@ List pusList = query.setString("name", "Pus%").list(); ]]>]]> You can externalize the resultset mapping informations in a - <resultset> element to either reuse them accross + <resultset> element to either reuse them across several named queries or through the setResultSetMapping() API. diff --git a/documentation/manual/src/main/docbook/en-US/content/transactions.xml b/documentation/manual/src/main/docbook/en-US/content/transactions.xml index 509a0f401f..1978b71f81 100644 --- a/documentation/manual/src/main/docbook/en-US/content/transactions.xml +++ b/documentation/manual/src/main/docbook/en-US/content/transactions.xml @@ -87,7 +87,7 @@ The most common pattern in a multi-user client/server application is session-per-request. In this model, a request from the client - is send to the server (where the Hibernate persistence layer runs), a new Hibernate + is sent to the server (where the Hibernate persistence layer runs), a new Hibernate Session is opened, and all database operations are executed in this unit of work. Once the work has been completed (and the response for the client has been prepared), the session is flushed and closed. You would also use a single database transaction to @@ -100,7 +100,7 @@ The challenge lies in the implementation. Hibernate provides built-in management of the "current session" to simplify this pattern. All you have to do is start a transaction when a server request has to be processed, and end the transaction - before the response is send to the client. You can do this in any way you + before the response is sent to the client. You can do this in any way you like, common solutions are ServletFilter, AOP interceptor with a pointcut on the service methods, or a proxy/interception container. An EJB container is a standardized way to implement cross-cutting aspects such as transaction @@ -174,7 +174,7 @@ - Clearly, we have to use several database transactions to implement the converastion. + Clearly, we have to use several database transactions to implement the conversation. In this case, maintaining isolation of business processes becomes the partial responsibility of the application tier. A single conversation usually spans several database transactions. It will be atomic if only one of @@ -189,7 +189,7 @@ Automatic Versioning - Hibernate can do automatic optimistic concurrency control for you, it can automatically detect - if a concurrent modification occured during user think time. Usually + if a concurrent modification occurred during user think time. Usually we only check at the end of the conversation. @@ -212,7 +212,7 @@ session-per-conversation and makes even reattachment unnecessary. Automatic versioning is used to isolate concurrent modifications and the Session is usually - not allowed to be flushed automatically, but explicitely. + not allowed to be flushed automatically, but explicitly. @@ -348,7 +348,7 @@ Database transaction demarcation - Datatabase (or system) transaction boundaries are always necessary. No communication with + Database (or system) transaction boundaries are always necessary. No communication with the database can occur outside of a database transaction (this seems to confuse many developers who are used to the auto-commit mode). Always use clear transaction boundaries, even for read-only operations. Depending on your isolation level and database capabilities this might not @@ -370,7 +370,7 @@ However, it is often desirable to keep your persistence layer portable between non-managed resource-local environments, and systems that can rely on JTA but use BMT instead of CMT. - In both cases you'd use programmatic transaction demaracation. Hibernate offers a wrapper + In both cases you'd use programmatic transaction demarcation. Hibernate offers a wrapper API called Transaction that translates into the native transaction system of your deployment environment. This API is actually optional, but we strongly encourage its use unless you are in a CMT session bean. @@ -544,7 +544,7 @@ catch (RuntimeException e) { }]]> - With CMT, transaction demarcation is done in session bean deployment descriptors, not programatically, + With CMT, transaction demarcation is done in session bean deployment descriptors, not programmatically, hence, the code is reduced to: @@ -569,7 +569,7 @@ catch (RuntimeException e) { in a CMT session bean, when you configure Hibernate's transaction factory. Remember to also set hibernate.transaction.manager_lookup_class. Furthermore, make sure that your hibernate.current_session_context_class is either unset (backwards - compatiblity), or set to "jta". + compatibility), or set to "jta". @@ -580,7 +580,7 @@ catch (RuntimeException e) { Iterator instances returned by scroll() or iterate(). You must release the underlying database cursor by calling ScrollableResults.close() or - Hibernate.close(Iterator) explicity from a finally + Hibernate.close(Iterator) explicitly from a finally block. (Of course, most applications can easily avoid using scroll() or iterate() at all from the JTA or CMT code.) @@ -615,8 +615,8 @@ catch (RuntimeException e) { Hibernate wraps SQLExceptions thrown while interacting with the database - in a JDBCException. In fact, Hibernate will attempt to convert the eexception - into a more meningful subclass of JDBCException. The underlying + in a JDBCException. In fact, Hibernate will attempt to convert the exception + into a more meaningful subclass of JDBCException. The underlying SQLException is always available via JDBCException.getCause(). Hibernate converts the SQLException into an appropriate JDBCException subclass using the SQLExceptionConverter @@ -674,7 +674,7 @@ catch (RuntimeException e) { Hibernate can at least control data access operations, ensuring that database level deadlocks and queries with huge result sets are limited by a defined timeout. In a managed environment, Hibernate can delegate transaction timeout - to JTA. This functioanlity is abstracted by the Hibernate + to JTA. This functionality is abstracted by the Hibernate Transaction object. @@ -762,7 +762,7 @@ session.close();]]> Clearly, manual version checking is only feasible in very trivial circumstances and not practical for most applications. Often not only single instances, but - complete graphs of modified ojects have to be checked. Hibernate offers automatic + complete graphs of modified objects have to be checked. Hibernate offers automatic version checking with either an extended Session or detached instances as the design paradigm. @@ -866,7 +866,7 @@ session.close();]]> Again, Hibernate will check instance versions during flush, throwing an - exception if conflicting updates occured. + exception if conflicting updates occurred. @@ -893,7 +893,7 @@ session.close();]]> even timestamps. In both cases, versioning can't rely on a particular column in a table. To force a version check without a version or timestamp property mapping, with a comparison of the state of all fields in a row, turn on optimistic-lock="all" - in the <class> mapping. Note that this concepetually only works + in the <class> mapping. Note that this conceptually only works if Hibernate can compare the old and new state, i.e. if you use a single long Session and not session-per-request-with-detached-objects. @@ -909,7 +909,7 @@ session.close();]]> comparison, Hibernate uses a single UPDATE statement (with an appropriate WHERE clause) per entity to execute the version check and update the information. If you use transitive persistence to cascade reattachment - to associated entities, Hibernate might execute uneccessary updates. This is usually + to associated entities, Hibernate might execute unnecessary updates. This is usually not a problem, but on update triggers in the database might be executed even when no changes have been made to detached instances. You can customize this behavior by setting select-before-update="true" in the @@ -925,7 +925,7 @@ session.close();]]> Pessimistic Locking - It is not intended that users spend much time worring about locking strategies. Its usually + It is not intended that users spend much time worrying about locking strategies. It's usually enough to specify an isolation level for the JDBC connections and then simply let the database do all the work. However, advanced users may sometimes wish to obtain exclusive pessimistic locks, or re-obtain locks at the start of a new transaction. @@ -1042,7 +1042,7 @@ session.close();]]> ON_CLOSE - is essentially the legacy behavior described above. The - Hibernate session obatins a connection when it first needs to perform some JDBC access + Hibernate session obtains a connection when it first needs to perform some JDBC access and holds unto that connection until the session is closed. diff --git a/documentation/manual/src/main/docbook/en-US/content/tutorial.xml b/documentation/manual/src/main/docbook/en-US/content/tutorial.xml index e8e8c3b0c0..a5eebc7a65 100644 --- a/documentation/manual/src/main/docbook/en-US/content/tutorial.xml +++ b/documentation/manual/src/main/docbook/en-US/content/tutorial.xml @@ -237,7 +237,7 @@ public class Event { ]]> - The id element is the declaration of the identifer property, + The id element is the declaration of the identifier property, name="id" declares the name of the Java property - Hibernate will use the getter and setter methods to access the property. The column attribute tells Hibernate which column of the @@ -776,7 +776,7 @@ else if (args[0].equals("list")) { Now disable hbm2ddl by commenting out the property in your hibernate.cfg.xml - file. Usually you only leave it turned on in continous unit testing, but another + file. Usually you only leave it turned on in continuous unit testing, but another run of hbm2ddl would drop everything you have stored - the create configuration setting actually translates into "drop all tables from the schema, then re-create all tables, when the SessionFactory is build". @@ -1144,7 +1144,7 @@ public void setEmailAddresses(Set emailAddresses) { }]]> - This time we didnt' use a fetch query to initialize the collection. + This time we didn't use a fetch query to initialize the collection. Hence, the call to its getter method will trigger an additional select to initialize it, so we can add an element to it. Monitor the SQL log and try to optimize this with an eager fetch. @@ -1216,7 +1216,7 @@ public void setParticipants(Set participants) { - Many developers program defensive and create link management methods to + Many developers program defensively and create link management methods to correctly set both sides, e.g. in Person: @@ -1346,7 +1346,7 @@ public class EventManagerServlet extends HttpServlet { Finally, the unit of work ends when processing and rendering is complete. If any - problem occured during processing or rendering, an exception will be thrown + problem occurred during processing or rendering, an exception will be thrown and the database transaction rolled back. This completes the session-per-request pattern. Instead of the transaction demarcation code in every servlet you could also write a servlet filter. @@ -1456,7 +1456,7 @@ out.close();]]> That's it, the servlet is complete. A request to the servlet will be processed in a single Session and Transaction. As earlier in the standalone application, Hibernate can automatically bind these - ojects to the current thread of execution. This gives you the freedom to layer + objects to the current thread of execution. This gives you the freedom to layer your code and access the SessionFactory in any way you like. Usually you'd use a more sophisticated design and move the data access code into data access objects (the DAO pattern). See the Hibernate Wiki for more @@ -1510,7 +1510,7 @@ out.close();]]> Before you compile and deploy the web application, note that an additional library is required: jsdk.jar. This is the Java servlet development kit, if you don't have this library already, get it from the Sun website and copy it to - your library directory. However, it will be only used for compliation and excluded + your library directory. However, it will be only used for compilation and excluded from the WAR package.