[jboss-cvs] JBossAS SVN: r97593 - projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 9 01:48:38 EST 2009
Author: laubai
Date: 2009-12-09 01:48:38 -0500 (Wed, 09 Dec 2009)
New Revision: 97593
Modified:
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/basic_mapping.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/batch.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/events.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/performance.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/persistent_classes.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_criteria.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_hql.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_sql.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/session_api.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/transactions.xml
projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/tutorial.xml
Log:
Added changes for JBPAPP-2965.
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/basic_mapping.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/basic_mapping.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/basic_mapping.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -3353,7 +3353,7 @@
private Long id; // identifier
private Date birthdate;
private Cat mother;
- private Set kittens
+ private Set kittens;
private Color color;
private char sex;
private float weight;
@@ -3470,10 +3470,10 @@
This is an example of a POJO class annotated as an EJB entity bean:
</para>
- <programlisting><![CDATA[@Entity(access = AccessType.FIELD)
+ <programlisting><![CDATA[@Entity
public class Customer implements Serializable {
- @Id;
+ @Id
Long id;
String firstName;
@@ -3493,14 +3493,6 @@
// Getter/setter and business methods
}]]></programlisting>
- <note>
- <title>Note</title>
- <para>
- Support for JDK 5.0 Annotations (and JSR-220) is currently under development.
- Please refer to the Hibernate Annotations module for more details.
- </para>
- </note>
-
</section>
</section>
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/batch.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/batch.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/batch.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -242,7 +242,7 @@
String hqlUpdate = "update Customer c set c.name = :newName where c.name = :oldName";
// or String hqlUpdate = "update Customer set name = :newName where name = :oldName";
-int updatedEntities = s.createQuery( hqlUpdate )
+int updatedEntities = session.createQuery( hqlUpdate )
.setString( "newName", newName )
.setString( "oldName", oldName )
.executeUpdate();
@@ -262,7 +262,7 @@
<programlisting><![CDATA[Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
String hqlVersionedUpdate = "update versioned Customer set name = :newName where name = :oldName";
-int updatedEntities = s.createQuery( hqlUpdate )
+int updatedEntities = session.createQuery( hqlVersionedUpdate )
.setString( "newName", newName )
.setString( "oldName", oldName )
.executeUpdate();
@@ -284,7 +284,7 @@
String hqlDelete = "delete Customer c where c.name = :oldName";
// or String hqlDelete = "delete Customer where name = :oldName";
-int deletedEntities = s.createQuery( hqlDelete )
+int deletedEntities = session.createQuery( hqlDelete )
.setString( "oldName", oldName )
.executeUpdate();
tx.commit();
@@ -367,7 +367,7 @@
Transaction tx = session.beginTransaction();
String hqlInsert = "insert into DelinquentAccount (id, name) select c.id, c.name from Customer c where ...";
-int createdEntities = s.createQuery( hqlInsert )
+int createdEntities = session.createQuery( hqlInsert )
.executeUpdate();
tx.commit();
session.close();]]></programlisting>
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/events.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/events.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/events.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -127,7 +127,7 @@
public void afterTransactionCompletion(Transaction tx) {
if ( tx.wasCommitted() ) {
- System.out.println("Creations: " + creates + ", Updates: " + updates, "Loads: " + loads);
+ System.out.println("Creations: " + creates + ", Updates: " + updates + "Loads: " + loads);
}
updates=0;
creates=0;
@@ -206,7 +206,7 @@
public void onLoad(LoadEvent event, LoadEventListener.LoadType loadType)
throws HibernateException {
if ( !MySecurity.isAuthorized( event.getEntityClassName(), event.getEntityId() ) ) {
- throw MySecurityException("Unauthorized access");
+ throw new MySecurityException("Unauthorized access");
}
}
}]]></programlisting>
@@ -232,7 +232,7 @@
<programlisting><![CDATA[Configuration cfg = new Configuration();
LoadEventListener[] stack = { new MyLoadListener(), new DefaultLoadEventListener() };
-cfg.EventListeners().setLoadEventListeners(stack);]]></programlisting>
+cfg.getEventListeners().setLoadEventListeners(stack);]]></programlisting>
<para>
Listeners registered declaratively cannot share instances. If the same class name is
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/performance.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/performance.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/performance.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -965,7 +965,7 @@
from the first-level cache.
</para>
- <programlisting><![CDATA[ScrollableResult cats = sess.createQuery("from Cat as cat").scroll(); //a huge result set
+ <programlisting><![CDATA[ScrollableResults cats = sess.createQuery("from Cat as cat").scroll(); //a huge result set
while ( cats.next() ) {
Cat cat = (Cat) cats.get(0);
doSomethingWithACat(cat);
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/persistent_classes.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/persistent_classes.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/persistent_classes.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -423,7 +423,6 @@
<programlisting><![CDATA[Session s = openSession();
Transaction tx = s.beginTransaction();
-Session s = openSession();
// Create a customer
Map david = new HashMap();
@@ -464,7 +463,7 @@
dynamicSession.save("Customer", david);
...
dynamicSession.flush();
-dynamicSession.close()
+dynamicSession.close();
...
// Continue on pojoSession
]]></programlisting>
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_criteria.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_criteria.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_criteria.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -82,7 +82,7 @@
.add( Restrictions.eq("age", new Integer(0) ) )
.add( Restrictions.eq("age", new Integer(1) ) )
.add( Restrictions.eq("age", new Integer(2) ) )
- ) )
+ )
.list();]]></programlisting>
<para>
@@ -113,7 +113,7 @@
.add( age.eq( new Integer(0) ) )
.add( age.eq( new Integer(1) ) )
.add( age.eq( new Integer(2) ) )
- ) )
+ )
.add( Property.forName("name").in( new String[] { "Fritz", "Izi", "Pk" } ) )
.list();]]></programlisting>
@@ -127,7 +127,7 @@
</para>
<programlisting><![CDATA[List cats = sess.createCriteria(Cat.class)
- .add( Restrictions.like("name", "F%")
+ .add( Restrictions.like("name", "F%") )
.addOrder( Order.asc("name") )
.addOrder( Order.desc("age") )
.setMaxResults(50)
@@ -347,11 +347,11 @@
<programlisting><![CDATA[List results = session.createCriteria(Cat.class)
.setProjection( Projections.projectionList()
- .add( Projections.rowCount().as("catCountByColor") )
+ .add( Projections.rowCount() )
.add( Property.forName("weight").avg().as("avgWeight") )
.add( Property.forName("weight").max().as("maxWeight") )
.add( Property.forName("color").group().as("color" )
- )
+ ) )
.addOrder( Order.desc("catCountByColor") )
.addOrder( Order.desc("avgWeight") )
.list();]]></programlisting>
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_hql.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_hql.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_hql.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -1178,8 +1178,8 @@
Collection elements can be ordered or grouped using a query filter:
</para>
- <programlisting><![CDATA[Collection orderedCollection = s.filter( collection, "order by this.amount" );
-Collection counts = s.filter( collection, "select this.type, count(this) group by this.type" );]]></programlisting>
+ <programlisting><![CDATA[Collection orderedCollection = s.createFilter( collection, "order by this.amount" ).list();
+ Collection counts = s.createFilter( collection, "select this.type, count(this) group by this.type" ).list();]]></programlisting>
<para>
You can find the size of a collection without initializing it:
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_sql.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_sql.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/query_sql.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -67,7 +67,7 @@
<programlisting><![CDATA[sess.createSQLQuery("SELECT * FROM CATS")
.addScalar("ID", Hibernate.LONG)
.addScalar("NAME", Hibernate.STRING)
- .addScalar("BIRTHDATE", Hibernate.DATE)
+ .addScalar("BIRTHDATE", Hibernate.DATE);
]]></programlisting>
<para>This query specified:</para>
@@ -96,7 +96,7 @@
<programlisting><![CDATA[sess.createSQLQuery("SELECT * FROM CATS")
.addScalar("ID", Hibernate.LONG)
.addScalar("NAME")
- .addScalar("BIRTHDATE")
+ .addScalar("BIRTHDATE");
]]></programlisting>
<para>This is essentially the same query as before, but now
@@ -162,7 +162,7 @@
<programlisting><![CDATA[sess.createSQLQuery("SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID")
.addEntity("cat", Cat.class)
- .addJoin("cat.dog");
+ .addJoin("dog", "cat.dog");
]]></programlisting>
<para>In this example, the returned <literal>Cat</literal>'s will have
@@ -175,7 +175,7 @@
<programlisting><![CDATA[sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM CATS c, DOGS d WHERE c.ID = d.CAT_ID")
.addEntity("cat", Cat.class)
- .addJoin("cat.dogs");
+ .addJoin("dog", "cat.dogs");
]]></programlisting>
<para>
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/session_api.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/session_api.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/session_api.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -44,7 +44,7 @@
relevant for the application developer when tuning the performance of the system.
</para>
- <sect1 id="objectstate-overview">
+ <section id="objectstate-overview">
<title>Hibernate object states</title>
<para>
@@ -95,9 +95,9 @@
trigger a transition) in more detail.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-makingpersistent" revision="1">
+ <section id="objectstate-makingpersistent" revision="1">
<title>Making objects persistent</title>
<para>
@@ -156,8 +156,7 @@
pk.setSex('F');
pk.setName("PK");
pk.setKittens( new HashSet() );
-pk.addKitten(fritz);
-sess.save( pk, new Long(1234) );]]></programlisting>
+pk.addKitten(fritz);]]></programlisting>
<para>
If the object you make persistent has associated objects (e.g. the
@@ -177,9 +176,9 @@
Transitive persistence is discussed later in this chapter.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-loading">
+ <section id="objectstate-loading">
<title>Loading an object</title>
<para>
@@ -224,7 +223,6 @@
<programlisting><![CDATA[Cat cat = (Cat) sess.get(Cat.class, id);
if (cat==null) {
cat = new Cat();
- sess.save(cat, id);
}
return cat;]]></programlisting>
@@ -259,9 +257,9 @@
<xref linkend="performance-fetching"/>.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-querying" revision="1">
+ <section id="objectstate-querying" revision="1">
<title>Querying</title>
<para>
@@ -273,7 +271,7 @@
optional support from Hibernate for result set conversion into objects.
</para>
- <sect2 id="objectstate-querying-executing" revision="1">
+ <section id="objectstate-querying-executing" revision="1">
<title>Executing queries</title>
<para>
@@ -301,9 +299,9 @@
Cat mother = (Cat) session.createQuery(
"select cat.mother from Cat as cat where cat = ?")
.setEntity(0, izi)
- .uniqueResult();]]
+ .uniqueResult();
-Query mothersWithKittens = (Cat) session.createQuery(
+Query mothersWithKittens = session.createQuery(
"select mother from Cat as mother left join fetch mother.kittens");
Set uniqueMothers = new HashSet(mothersWithKittens.list());]]></programlisting>
@@ -318,7 +316,7 @@
these duplicates through a <literal>Set</literal>.
</para>
- <sect3 id="objectstate-querying-executing-iterate">
+ <section id="objectstate-querying-executing-iterate">
<title>Iterating results</title>
<para>
@@ -337,17 +335,17 @@
Iterator iter = sess.createQuery("from eg.Qux q order by q.likeliness").iterate();
while ( iter.hasNext() ) {
Qux qux = (Qux) iter.next(); // fetch the object
- // something we couldnt express in the query
+ // something we couldn't express in the query
if ( qux.calculateComplicatedAlgorithm() ) {
// delete the current instance
iter.remove();
- // dont need to process the rest
+ // don't need to process the rest
break;
}
}]]></programlisting>
- </sect3>
+ </section>
- <sect3 id="objectstate-querying-executing-tuples">
+ <section id="objectstate-querying-executing-tuples">
<title>Queries that return tuples</title>
<para>
@@ -367,9 +365,9 @@
....
}]]></programlisting>
- </sect3>
+ </section>
- <sect3 id="objectstate-querying-executing-scalar" revision="1">
+ <section id="objectstate-querying-executing-scalar" revision="1">
<title>Scalar results</title>
<para>
@@ -392,9 +390,9 @@
.....
}]]></programlisting>
- </sect3>
+ </section>
- <sect3 id="objectstate-querying-executing-parameters">
+ <section id="objectstate-querying-executing-parameters">
<title>Bind parameters</title>
<para>
@@ -442,9 +440,9 @@
q.setParameterList("namesList", names);
List cats = q.list();]]></programlisting>
- </sect3>
+ </section>
- <sect3 id="objectstate-querying-executing-pagination">
+ <section id="objectstate-querying-executing-pagination">
<title>Pagination</title>
<para>
@@ -463,9 +461,9 @@
SQL of your DBMS.
</para>
- </sect3>
+ </section>
- <sect3 id="objectstate-querying-executing-scrolling">
+ <section id="objectstate-querying-executing-scrolling">
<title>Scrollable iteration</title>
<para>
@@ -495,7 +493,7 @@
while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add( cats.get(1) );
}
-cats.close()]]></programlisting>
+cats.close();]]></programlisting>
<para>
Note that an open database connection and cursor is required for this
@@ -503,9 +501,9 @@
if you need offline pagination functionality.
</para>
- </sect3>
+ </section>
- <sect3 id="objectstate-querying-executing-named" revision="1">
+ <section id="objectstate-querying-executing-named" revision="1">
<title>Externalizing named queries</title>
<para>
@@ -526,7 +524,7 @@
<programlisting><![CDATA[Query q = sess.getNamedQuery("ByNameAndMaximumWeight");
q.setString(0, name);
-q.setInt(1, minWeight);
+q.setInteger(1, minWeight);
List cats = q.list();]]></programlisting>
<para>
@@ -543,11 +541,11 @@
<literal>eg.Cat.ByNameAndMaximumWeight</literal>.
</para>
- </sect3>
+ </section>
- </sect2>
+ </section>
- <sect2 id="objectstate-filtering" revision="1">
+ <section id="objectstate-filtering" revision="1">
<title>Filtering collections</title>
<para>
A collection <emphasis>filter</emphasis> is a special type of query that can be applied to
@@ -560,7 +558,7 @@
"where this.color = ?")
.setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )
.list()
-);]]></programlisting>
+]]></programlisting>
<para>
The returned collection is considered a bag that is a copy of the given
@@ -588,9 +586,9 @@
.setFirstResult(0).setMaxResults(10)
.list();]]></programlisting>
- </sect2>
+ </section>
- <sect2 id="objecstate-querying-criteria" revision="1">
+ <section id="objecstate-querying-criteria" revision="1">
<title>Criteria queries</title>
<para>
@@ -609,9 +607,9 @@
API are discussed in more detail in <xref linkend="querycriteria"/>.
</para>
- </sect2>
+ </section>
- <sect2 id="objectstate-querying-nativesql" revision="2">
+ <section id="objectstate-querying-nativesql" revision="2">
<title>Queries in native SQL</title>
<para>
@@ -631,7 +629,7 @@
"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... " +
"FROM CAT {cat} WHERE ROWNUM<10")
.addEntity("cat", Cat.class)
-.list()]]></programlisting>
+.list();]]></programlisting>
<para>
SQL queries can contain named and positional parameters, just like Hibernate queries.
@@ -639,11 +637,11 @@
<xref linkend="querysql"/>.
</para>
- </sect2>
+ </section>
- </sect1>
+ </section>
- <sect1 id="objectstate-modifying" revision="1">
+ <section id="objectstate-modifying" revision="1">
<title>Modifying persistent objects</title>
<para>
@@ -682,9 +680,9 @@
</para>
</important>
- </sect1>
+ </section>
- <sect1 id="objectstate-detached" revision="2">
+ <section id="objectstate-detached" revision="2">
<title>Modifying detached objects</title>
<para>
@@ -757,9 +755,9 @@
Other models for long units of work are discussed in <xref linkend="transactions-optimistic"/>.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-saveorupdate">
+ <section id="objectstate-saveorupdate">
<title>Automatic state detection</title>
<para>
@@ -895,9 +893,9 @@
</listitem>
</itemizedlist>
- </sect1>
+ </section>
- <sect1 id="objectstate-deleting" revision="1">
+ <section id="objectstate-deleting" revision="1">
<title>Deleting persistent objects</title>
<para>
@@ -917,9 +915,9 @@
children.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-replicating" revision="1">
+ <section id="objectstate-replicating" revision="1">
<title>Replicating object between two different datastores</title>
<para>
@@ -931,7 +929,7 @@
<programlisting><![CDATA[//retrieve a cat from one database
Session session1 = factory1.openSession();
Transaction tx1 = session1.beginTransaction();
-Cat cat = session1.get(Cat.class, catId);
+Cat cat = (Cat) session1.get(Cat.class, catId);
tx1.commit();
session1.close();
@@ -981,9 +979,9 @@
rolling back changes made during non-ACID transactions and more.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-flushing">
+ <section id="objectstate-flushing">
<title>Flushing the Session</title>
<para>
@@ -1081,7 +1079,7 @@
izi.setName(iznizi);
// might return stale data
-sess.find("from Cat as cat left outer join cat.kittens kitten");
+sess.createQuery("from Cat as cat left outer join cat.kittens kitten");
// change to izi is not flushed!
...
@@ -1094,9 +1092,9 @@
behavior, we discuss it in <xref linkend="transactions"/>.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-transitive" revision="1">
+ <section id="objectstate-transitive" revision="1">
<title>Transitive persistence</title>
<para>
@@ -1248,9 +1246,9 @@
<literal>Session</literal>.
</para>
- </sect1>
+ </section>
- <sect1 id="objectstate-metadata">
+ <section id="objectstate-metadata">
<title>Using metadata</title>
<para>
@@ -1270,7 +1268,7 @@
<programlisting><![CDATA[Cat fritz = ......;
ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);
-Object[] propertyValues = catMeta.getPropertyValues(fritz);
+Object[] propertyValues = catMeta.getPropertyValues(fritz, EntityMode.POJO);
String[] propertyNames = catMeta.getPropertyNames();
Type[] propertyTypes = catMeta.getPropertyTypes();
@@ -1282,7 +1280,7 @@
}
}]]></programlisting>
- </sect1>
+ </section>
</chapter>
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/transactions.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/transactions.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/transactions.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -726,7 +726,7 @@
// do some work
...
- sess.getTransaction().commit()
+ sess.getTransaction().commit();
}
catch (RuntimeException e) {
sess.getTransaction().rollback();
@@ -776,7 +776,7 @@
int oldVersion = foo.getVersion();
session.load( foo, foo.getKey() ); // load the current state
-if ( oldVersion != foo.getVersion() ) throw new StaleObjectStateException();
+if ( oldVersion != foo.getVersion() ) throw new StaleObjectStateException("Message", foo.getId());
foo.setProperty("bar");
t.commit();
Modified: projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/tutorial.xml
===================================================================
--- projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/tutorial.xml 2009-12-09 06:46:36 UTC (rev 97592)
+++ projects/docs/enterprise/EWP_5.0/Hibernate/Hibernate_Core/en-US/tutorial.xml 2009-12-09 06:48:38 UTC (rev 97593)
@@ -91,49 +91,79 @@
many IDEs to automatically set up a project for us based on the maven descriptor.
</para>
- <programlisting><![CDATA[<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+ <programlisting><![CDATA[<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://
+maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<groupId>org.hibernate.tutorials</groupId>
<artifactId>hibernate-tutorial</artifactId>
<version>1.0.0-SNAPSHOT</version>
+ <packaging>war</packaging>
<name>First Hibernate Tutorial</name>
+ <build>
+ <!--
+ we dont want the version to be part of the generated war file name
+ -->
+ <finalName>${artifactId}</finalName>
+ <!--
+ we dont want to use the jars maven provided, we want to use JBoss' ones
+ -->
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
+ </configuration>
+ </plugin>
+ </plugins>
- <build>
- <!-- we dont want the version to be part of the generated war file name -->
- <finalName>${artifactId}</finalName>
</build>
-
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
+ <version>3.3.2.GA</version>
</dependency>
-
- <!-- Because this is a web app, we also have a dependency on the servlet api. -->
+ <!--
+ Because this is a web app, we also have a dependency on the servlet
+ api.
+ -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
+ <version>2.3</version>
</dependency>
-
- <!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend -->
+ <!--
+ Hibernate uses slf4j for logging, for our purposes here use the
+ simple backend
+ -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
+ <version>1.5.8</version>
</dependency>
-
- <!-- Hibernate gives you a choice of bytecode providers between cglib and javassist -->
+ <!--
+ Hibernate gives you a choice of bytecode providers between cglib and
+ javassist
+ -->
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
+ <version>3.9.0.GA</version>
</dependency>
+ <!--
+ We will use the HSQLDB as the backend database for our tutorial
+ -->
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.2</version>
+ </dependency>
</dependencies>
+</project>
+
+]]></programlisting>
-</project>]]></programlisting>
-
<note>
<para>
It is not a requirement to use Maven. If you wish to use another technology to
@@ -914,7 +944,7 @@
</hibernate-mapping>]]></programlisting>
<para>
- Finally, add the new mapping to Hibernate's configuration:
+ Finally, add the new mapping to Hibernate's configuration immediately after the existing mapping for <filename>Event.hbm.xml</filename>:
</para>
<programlisting><![CDATA[<mapping resource="events/Event.hbm.xml"/>
@@ -1271,10 +1301,12 @@
Now map this side of the association in <literal>Event.hbm.xml</literal>.
</para>
- <programlisting><![CDATA[ <set name="participants" table="PERSON_EVENT" inverse="true">
- <key column="EVENT_ID"/>
- <many-to-many column="PERSON_ID" class="events.Person"/>
- </set>]]></programlisting>
+ <programlisting><![CDATA[
+<set name="participants" table="PERSON_EVENT" inverse="true">
+ <key column="EVENT_ID"/>
+ <many-to-many column="PERSON_ID" class="org.hibernate.tutorial.domain.Person"/>
+</set>
+ ]]></programlisting>
<para>
These are normal <literal>set</literal> mappings in both mapping documents.
@@ -1581,22 +1613,21 @@
<para>
To build and deploy call <literal>mvn package</literal> in your
project directory and copy the <filename>hibernate-tutorial.war</filename>
- file into your Tomcat <filename>webapps</filename> directory.
+ file into your <filename>$JBOSS_HOME/server/$CONFIG/deploy</filename> directory.
</para>
- <note>
+<!-- <note>
<para>
If you do not have Tomcat installed, download it from
<ulink url="http://tomcat.apache.org/"/> and follow the
installation instructions. Our application requires
no changes to the standard Tomcat configuration.
</para>
- </note>
+ </note>-->
<para>
- Once deployed and Tomcat is running, access the application at
- <literal>http://localhost:8080/hibernate-tutorial/eventmanager</literal>. Make
- sure you watch the Tomcat log to see Hibernate initialize when the first
+ Once deployed and JBoss is running, access the application at
+ <literal>http://localhost:8080/hibernate-tutorial/eventmanager</literal>. Watch the server log (in <filename>$JBOSS_HOME/server/$CONFIG/log/server.log</filename>) to see Hibernate initialize when the first
request hits your servlet (the static initializer in <literal>HibernateUtil</literal>
is called) and to get the detailed output if any exceptions occurs.
</para>
More information about the jboss-cvs-commits
mailing list