Looking over the source, I'm wondering about a comment in HibeAggregatorDAO

        // if cascade worked, we could just do this
        //removeObject(feed);

this is followed by:

ses.delete( "select newsfeed.subscriptions.elements "
                +"from newsfeed in class ag.Newsfeed" )

which should be

ses.delete( "select newsfeed.subscriptions.elements "
                +"from newsfeed in class ag.Newsfeed "
                +"where newsfeed = ?",
                 feed, Hibernate.association(feed) );

but you wouldn't need that whole line if you had:

  <set role="subscriptions" table="subscription" cascade="delete">
   <key column="newsfeed_id" length="32" />
   <one-to-many class="ag.Subscription" />
  </set>

in the mapping......


P.S. I'm not keen on the way you add items to bidirectional association. The
correct idiom is:

parent.getChildren().add(child); //yes, even if the children collection is
readonly="true"
child.setParent(parent);
sess.save(child);

omitting the first line could cause bugs in more complicated circumstances.

----- Original Message -----
From: "David M. Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 01, 2002 1:29 AM
Subject: [Hibernate] Hibernate vs. Castor example


>
> I've written a simple example application that shows how
> to create a simple web application (a newsfeed aggregator)
> with a pluggable persistence layer. I used the tried
> and true DAO pattern to hide the database access
> mechanism from the rest of the application.
> I implemented the DAO interface with both Hibernate
> and Castor.
>
> I did this to learn:
>
> - What are the drawbacks of hiding powerful persistence
> engine behind a simple DAO interface. What do you loose?
> Will long transaction support work? What about lazy loading?
>
> - What are the differences between and strenghts/weaknesses
> of Castor and Hibernate?
>
> - What is the best way to implement DAO with each of
> the tools.
>
> The code is very simple and (I hope) easy to follow,
> so if you have a chance please take a look. Look at the
> HibeAggregatorDAO and CastorAggregatorDAO implementations
> to see how I used Hiberate and Castor to implement the
> very same DAO. I'd love to get your opinions on the
> above topics.
>
> The readme is here:
> http://sourceforge.net/project/shownotes.php?release_id=125110
>
> The download is here:
> http://sourceforge.net/project/showfiles.php?group_id=47722
>
>
> Thanks,
> - Dave
>
> http://www.rollerweblogger.org/page/roller
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Get the new Palm Tungsten T
> handheld. Power & Color in a compact size!
> http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to