db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian McCallister <mccallis...@forthillcompany.com>
Subject Re: First Stab at PB Tutorial Refactoring
Date Mon, 18 Aug 2003 12:48:44 GMT
My first take on it used the normal exception handling. I then changed 
it to just try { ... } finally { broker.close() }. In the end I chose 
to eliminate exception handling altogether in order to show exactly how 
easy to use the PB API is.

I *should* include something on it though. I am thinking after the 
intro to the CRUD operations where I mention silly things like why it 
retrieves a new broker for each operation, etc, that it should discuess 
the exceptions. As OJB is written they are all RuntimeException derived 
(thank you!) catching them is technically optional. While they will be 
caught under normal usage. Must think on this a little bit more.

Primitives as PK: Good catch, I forgot all about that while taking the 
samples from tutorial1 apart. Even after, gee this code looks funny, 
using primitives, but I guess you can do that with OJB =)

On making mapping its own tutorial and not discussing it at all in the 
API specific ones - I think you are right, it really is an orthogonal 
concern.

Thank you, everyone (Charles, Armin, Jim, Jakob) for the quick feedback!

-Brian

On Friday, August 15, 2003, at 04:29 PM, Jim Shingler wrote:

> 2 Cents for what it is worth.
>
> Primitive times.  Good Catch.  Make sure examples don't show bad style.
>
> Exception handling.  Again good Idea.  As long as it doesn't overload
> the section.  Should it be a separate topic?
>
> -----Original Message-----
> From: Armin Waibel [mailto:armin@code-au-lait.de]
> Sent: Friday, August 15, 2003 3:54 PM
> To: OJB Developers List
> Subject: Re: First Stab at PB Tutorial Refactoring
>
>
> Hi Brain,
>
>> Found some time this week to start reworking on the PB Tutorial per a
>> request from Armin.
>>
>> My thought is to focus very tightly on using the API, and pull out the
>
>> "Intro to Mapping" part into a separate tutorial, thereby allowing the
>
>> PB tutorial to really just look at the PB API. Additionally, I want to
>
>> make the tutorials *not* depend on each other. Someone looking at how
>> to use the ODMG API shouldn't need (though they probably should
> anyway)
>> need to read through the PB API tutorial to make sense of the ODMG API
>
>> tutorial.
>>
> +1
>
>> Anyway...
>>
>> A draft is up at http://fischer.skife.org/ojb/pb-tutorial.html
>>
>> This tutorial is a draft, and still needs:
>> testing (code hasn't been run, but it parses correctly)
>> links to advanced topics and javadocs for things referenced
>> (drill-down capability) ???
>>
>> Right now tutorial1 serves as a general introduction to OJB -- this
>> tutorial does not, it is just an introduction to the PB, so a new "go
>> here first" document with the OJB intro given in tutorial1 needs to be
>
>> put together.
>>
> +1
>
>> As this will likely contain the first look at OJB code many people
> will
>> see it needs to be pretty strong, so lots of feedback is appreciated.
>>
> Read your (so-called - think it's near perfect) draft.
> Till this day I don't realize how easy to use PB-api is ;-)
>
> ok, two things to annotate:
>
> - Should we use primitive types (particularly as PK) in sample class?
> (e.g. foreign-key/null/0 problem)
>
> - What about exception handling? Would exception
> handling kill simplicity of the example?
>
> public static void storeProduct(Product product)
>     {
>         PersistenceBroker broker =
> PersistenceBrokerFactory.defaultPersistenceBroker();
>         try
>        {
>           broker.store(product);
>         }
>         catch(PersistenceBrokerException e)
>         {
>             broker.abortTransaction();
>          }
>          finally
>
>
>              if(broker != null) broker.close();
>          }
>     }
>
> regards,
> Armin
>
>> -Brian
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message