You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vjeran Marcinko <vj...@tis.hr> on 2005/01/07 09:57:55 UTC

Data objects (Hibernate) reattaching useless for web tier?

Hi.

This isn't specific for Tapestry web tier, but in general, and since I guess
lots of people here worked with Hibernate CRUD Tapestry web apps, maybe you
can help me...
Hibernate's ability to reattach previously loaded data instances is supose
to be cool, because you can update/delete/reattach it later in subsequent
request, for eg. when it has been returned from UI (web) tier where it has
been changed, after pressing form's Submit. But since web is supose to be
stateless (avoiding HttpSession), you cannot store this previously loaded
instance anywhere to be fetched for later deletion/updating or whatever...?
Am I right? You only can store object's ID (db row ID in fact), and then
after Submit, load this instance from db again, populate it with new values,
and then update it... Hmm, it even sound like some performance burden since
2 sql commands have to be issued - SELECT and then UPDATE, after form
submit.

I had taken a look at some sample Tapestry tutorials, and there is used
empty object instance after submit, which is populated with all needed
fields, thus avoiding SELECT. But it only works if ALL fields that comprise
data instance have been previously stored as visible or hidden fields. Which
is problematic if instance has lets say collection reference (foreign keys),
that we're not interested on this "edit" screen, but they comprise data
instance nonetheless, and have to be populated also when instance is updated
to db, or otherwise pesistance layer will think that all relations to this
collections has to be removed from db ??

How do you solve these problems?

-Vjeran



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 3.1.2005


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Data objects (Hibernate) reattaching useless for web tier?

Posted by Konstantin Ignatyev <kg...@yahoo.com>.
My guess will be: do not avoid SELECT, just enable
Hibernate's second level cache. There is a good chance
that object will be kept in cache and SELECT by ID
will not hit the DB. 

--- Vjeran Marcinko <vj...@tis.hr> wrote:

> Hi.
> 
> This isn't specific for Tapestry web tier, but in
> general, and since I guess
> lots of people here worked with Hibernate CRUD
> Tapestry web apps, maybe you
> can help me...
> Hibernate's ability to reattach previously loaded
> data instances is supose
> to be cool, because you can update/delete/reattach
> it later in subsequent
> request, for eg. when it has been returned from UI
> (web) tier where it has
> been changed, after pressing form's Submit. But
> since web is supose to be
> stateless (avoiding HttpSession), you cannot store
> this previously loaded
> instance anywhere to be fetched for later
> deletion/updating or whatever...?
> Am I right? You only can store object's ID (db row
> ID in fact), and then
> after Submit, load this instance from db again,
> populate it with new values,
> and then update it... Hmm, it even sound like some
> performance burden since
> 2 sql commands have to be issued - SELECT and then
> UPDATE, after form
> submit.
> 
> I had taken a look at some sample Tapestry
> tutorials, and there is used
> empty object instance after submit, which is
> populated with all needed
> fields, thus avoiding SELECT. But it only works if
> ALL fields that comprise
> data instance have been previously stored as visible
> or hidden fields. Which
> is problematic if instance has lets say collection
> reference (foreign keys),
> that we're not interested on this "edit" screen, but
> they comprise data
> instance nonetheless, and have to be populated also
> when instance is updated
> to db, or otherwise pesistance layer will think that
> all relations to this
> collections has to be removed from db ??
> 
> How do you solve these problems?
> 
> -Vjeran
> 
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.6.8 - Release
> Date: 3.1.2005
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 
> 


=====
Konstantin Ignatyev




PS: If this is a typical day on planet earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000

Bowers, C.A.  The Culture of Denial:  Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools.  New York:  State University of New York Press, 1997: (4) (5) (p.206)

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org