User: gropi   
  Date: 01/09/20 23:32:29

  Modified:    src/docs cmp-two.jsp
  Log:
  A revised version is included in the manual now. For some time this file will
  still be here, pointing people to the manual now.
  
  Revision  Changes    Path
  1.2       +1 -240    newsite/src/docs/cmp-two.jsp
  
  Index: cmp-two.jsp
  ===================================================================
  RCS file: /cvsroot/jboss/newsite/src/docs/cmp-two.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- cmp-two.jsp       2001/08/30 22:29:19     1.1
  +++ cmp-two.jsp       2001/09/21 06:32:29     1.2
  @@ -8,245 +8,6 @@
   
                <!-- CONTENT -->
   <p class="text">
  -<b>This feature is only available in the CVS version of JBoss. Please note that
  -the code for CMP 2.x support is still in ALPHA state. Try it out, give
  -feedback, but don't built any production machines with it ! You have
  -been warned ...</b>
  -<br>
  +Information about CMP 2.0 support has been revised and is now included in the 
regular <a href="documentation/HTML/index.html">JBoss manual</a>. 
   </p>
  -<p class="text">I will attempt to
  -explain how to turn on the new features in CMP 2.x
  -</p>
  -
  -<ol class="text">
  -<li><p class="text">Specify the ejb-jar.xml to validate with the EJB 2.0 DTD. 
Change the
  -doctype in your current ejb-jar.xml to the following:
  -</p>
  -<pre>
  -
  -&lt;!DOCTYPE jar-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 
2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd"&gt;
  -
  -</pre>
  -
  -<p class="text">This will activate the new persistence store, and turn on the first 
two
  -features CMP 2.x abstract accessors and Tuned updates.  Tuned updates are
  -now always on; this is a side affect of eager/lazy loading.
  -</p><br>
  -</li>
  -<li><p class="text">Add a jbosscmp-jdbc.xml to the META-INF directory of your jar. 
The format
  -is similar to jaws.xml, with one major change around finder specification.
  -Everything else is new, so just build one according to the jaws docs.<br>
  -</p>
  -</li>
  -<li>
  -<p class="text">Eager loading:  The new &lt;eager-load&gt; element is declared 
after your
  -&lt;cmp-field&gt; elements in the &lt;entity&gt; section. Eager load tells the store
  -manager which fields to load when loading your bean from the database.  In
  -CMP 1.x every field in the bean was eager loaded, and this is the default if
  -eager-load is not specified. The XML follows:
  -</p>
  -<pre>
  -
  -&lt;eager-load&gt;
  - &lt;field-name&gt;title&lt;/field-name&gt;
  - &lt;field-name&gt;artist&lt;/field-name&gt;
  -&lt;/eager-load&gt;
  -
  -</pre>
  -
  -<p class="text">This tells the manager to only load the title and artist fields.  In
  -addition to these two fields, the manager always loads the primary key
  -fields. If you would like to not eager-load any fields, just specify an
  -empty &lt;eager-load&gt; element. In the future I plan on adding a similar section
  -to the query metadata.</p><br>
  -</li>
  -<li><p class="text">
  -Lazy load groups:  Lazy loading is the other half of eager loading.  If a
  -field is not eager loaded it must be lazy loaded. I have added the concept
  -of what I am calling lazy load groups (I'm considering changing it to sets).
  -When the bean code accesses an unloaded field, the manager loads the field
  -and any field in a group that the unloaded field is a member.  Think of the
  -groups as a set. The manager performs a set join and then removes any field
  -that is already loaded. The lazy-load-groups element should follow the
  -&lt;eager-load&gt; element in the &lt;entity&gt;. An example follows:
  -</p>
  -<pre>
  -
  -&lt;lazy-load-groups&gt;
  - &lt;lazy-load-group&gt;
  -  &lt;field-name&gt;type&lt;/field-name&gt;
  -  &lt;field-name&gt;notes&lt;/field-name&gt;
  - &lt;/lazy-load-group&gt;
  - &lt;lazy-load-group&gt;
  -  &lt;field-name&gt;notes&lt;/field-name&gt;
  -  &lt;field-name&gt;producer&lt;/field-name&gt;
  - &lt;/lazy-load-group&gt;
  -&lt;/lazy-load-groups&gt;
  -
  -</pre>
  -
  -<p class="text">If the bean code accesses type, the manager loads type and notes. 
If the
  -bean code accesses, notes the manager will load notes, type and producer.
  -</p><br>
  -</li>
  -
  -<li><p class="text">Read-only columns: &lt;cmp-field&gt; element can now contain 
then &lt;read-only&gt;
  -and &lt;time-out&gt; elements. These elements work the same way as they do in the
  -&lt;entity&gt; tag.  If a field is read-only, it will not be stored or inserted
  -into the database. If a pk field is read-only, bean create will throw a
  -CreateException. If a set accessor is called for a read-only field, it
  -throws an EJBException.  Read-only fields are important for fields that are
  -filled in by database triggers, such as last update.
  -</p><br>
  -</li>
  -<li><p class="text">Dependent value classes: DVCs are just cmp fields that have a 
java object
  -type, other then the automatically recognized types. This comes from section
  -10.3.3 of EJB2.0 pfd2. The specification specifically does not describe the
  -internal structure of the object.  I require that DVCs follow the Java Beans
  -naming specification for getters and setters.  Each property you would like
  -saved to the database must have both a getter and a setter.  The bean must
  -be serializable and must have a no-arg constructor.  These requirements
  -extend to all properties that will be saved.
  -</p>
  -<p class="text">
  -Ok, now we have a valid DVC. All we need to do is tell the manager about it.
  -The DVC is specified in the jbosscmp-jdbc.xml file as follows:
  -</p>
  -<pre>
  -
  -&lt;dependent-value-classes&gt;
  - &lt;dependent-value-class&gt;
  -  &lt;description&gt;address information&lt;/description&gt;
  -  &lt;class&gt;com.hypothermic.example.cd.Address&lt;/class&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;line1&lt;/property-name&gt;
  -   &lt;column-name&gt;LINE1&lt;/column-name&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;line2&lt;/property-name&gt;
  -   &lt;column-name&gt;LINE2&lt;/column-name&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;city&lt;/property-name&gt;
  -   &lt;column-name&gt;CITY&lt;/column-name&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;state&lt;/property-name&gt;
  -   &lt;column-name&gt;ST&lt;/column-name&gt;
  -   &lt;jdbc-type&gt;VARCHAR&lt;/jdbc-type&gt;
  -   &lt;sql-type&gt;VARCHAR(2)&lt;/sql-type&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;zip&lt;/property-name&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;zipPlusFour&lt;/property-name&gt;
  -   &lt;column-name&gt;ZIP_4&lt;/column-name&gt;
  -  &lt;/property&gt;
  - &lt;/dependent-value-class&gt;
  - &lt;dependent-value-class&gt;
  -  &lt;description&gt;Credit Card&lt;/description&gt;
  -  &lt;class&gt;com.hypothermic.example.cd.Card&lt;/class&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;cardHolder&lt;/property-name&gt;
  -   &lt;column-name&gt;CARD_HOLDER&lt;/column-name&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;billingAddress&lt;/property-name&gt;
  -   &lt;column-name&gt;ADD&lt;/column-name&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;cardNumber&lt;/property-name&gt;
  -   &lt;column-name&gt;CARD_NUMBER&lt;/column-name&gt;
  -  &lt;/property&gt;
  - &lt;/dependent-value-class&gt;
  -&lt;/dependent-value-classes&gt;
  -
  -</pre>
  -<p class="text">
  -This section should appear after the &lt;enterprise-beans&gt; element.  The
  -specification is based on the &lt;entity&gt; element, so it should be
  -self-explanatory.
  -</p>
  -
  -<p class="text">
  -When the manager encounters a field that has the type of a specified DVC, it
  -will persist this field to the columns specified. DVCs can be constructed
  -from other DVCs, so when the manager runs into a DVC it flattens it into a
  -set of columns. If the manager finds a DVC circuit, it will throw an
  -EJBException. Property mappings can be overridden in the entity element as
  -follows:
  -</p>
  -<pre>
  -
  -&lt;entity&gt;
  - &lt;name-name&gt;CustomerBean&lt;/name-name&gt;
  - &lt;table-name&gt;CUSTOMER&lt;/table-name&gt;
  - &lt;cmp-field&gt;
  -  &lt;field-name&gt;userId&lt;/field-name&gt;
  -  &lt;column-name&gt;USER_ID&lt;/column-name&gt;
  - &lt;/cmp-field&gt;
  - &lt;cmp-field&gt;
  -  &lt;field-name&gt;creditCard&lt;/field-name&gt;
  -  &lt;column-name&gt;CREDIT_CARD&lt;/column-name&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;cardNumber&lt;/property-name&gt;
  -   &lt;column-name&gt;CC_NUM&lt;/column-name&gt;
  -   &lt;jdbc-type&gt;VARCHAR&lt;/jdbc-type&gt;
  -   &lt;sql-type&gt;VARCHAR(20)&lt;/sql-type&gt;
  -  &lt;/property&gt;
  -  &lt;property&gt;
  -   &lt;property-name&gt;billingAddress.line1&lt;/property-name&gt;
  -   &lt;column-name&gt;ADDRESS_LINE1&lt;/column-name&gt;
  -  &lt;/property&gt;
  - &lt;/cmp-field&gt;
  -&lt;/entity&gt;
  -
  -</pre>
  -<p class="text">
  -Pretty simple right?  The only thing to note is the billingAddress.line1.
  -When overriding property info in the entity, you need to refer to the
  -property from a flat perspective.
  -</p><br>
  -</li>
  -<li><p class="text">
  -Finder specification:  I have changed the specification of finders to
  -bring them more in line with ejb-ql.  Here is an example finder:
  -</p>
  -<pre>
  -
  -&lt;query&gt;
  - &lt;description&gt;Search all fields in cd&lt;/description&gt;
  - &lt;query-method&gt;
  -  &lt;method-name&gt;findInAnyField&lt;/method-name&gt;
  -  &lt;method-params&gt;
  -   &lt;method-param&gt;java.lang.String&lt;/method-param&gt;
  -  &lt;/method-params&gt;
  - &lt;/query-method&gt;
  - &lt;declared-sql&gt;
  -  &lt;where&gt;TITLE={0} OR ARTIST={0} OR TYPE={0} OR NOTES={0}&lt;/where&gt;
  - &lt;/declared-sql&gt;
  -&lt;/query&gt;
  -
  -</pre>
  -<p class="text">
  -The query-method element is right out of the EJB 2.0 spec. The
  -&lt;declared-sql&gt; element is similar to jaws finder element, except I have
  -broken the query element into from and where. I also support order as jaws
  -did.  The new code doesn't have the new pre-load logic, but I will add
  -something similar in phase 3, where I'll add ejb-ql support.
  -</p><br>
  -</li>
  -</ol>
  -<p class="text">I hope someone tries the new cmp code, as I haven't had time to do a
  -complete test.  I have a limited unit test that I can send anyone interested
  -(just send me a personal email). I will write a complete test in phase 4.
  -</p>
  -<p class="text">If you find any bugs or would like to request a feature, please use 
the tracker at Sourceforge for the JBoss project. I
  -will fix bugs as they are discovered, and feature req1uests I will
  -definitely think over.
  -</p>
  -Dain Sundstrom<br>
  -dain "at" daingroup.com
  -
   <jsp:include page="navigation.jsp" flush="true" />   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to