struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Watrous" <dwatr...@hotmail.com>
Subject Re: Hibernate object relational mapping
Date Thu, 10 Feb 2005 15:21:35 GMT
Brian,

I use hibernate for a couple of reasons, some of which have already been 
mentioned.  In some cases using hibernates sophisticated caching system can 
greatly improve the speed of an application.  I have also found that the 
more I can think about the OBJECTS in my application without the concern for 
how those objects are persisted, the truer my design is to general OO 
principles.

Also since various of my programs require both web interfaces and rich 
client interfaces I benefit from using a single set of DAOs that map through 
hibernate.  This way if I need to communicate with an HSQL DB using the rich 
client and later synchronize with the main database, this is possible by 
changing a single line in the hibernate configuration.

Good Luck!

DW
----- Original Message ----- 
From: "Lee Harrington" <leebase@gmail.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, February 10, 2005 8:10 AM
Subject: Re: Hibernate object relational mapping


>I use hibernate...it's not a "tool for those who don't know sql" -- as
> I've been a database developer for 20+ years.
>
> It's a tool for those who:
> 1.  don't want to have to write a lot of redundant code just to
> insert, update, delete
> 2. don't want to have to hand code "class.property =
> recordset.getField("fieldName")" out the yin yang
> 3.  don't want to have to hand code different data layers for
> different database systems
>
> Consider on form submit....
>
> You could write:
>
> sqlStr = "insert into mytable (field1, field2.....field15') values (" +
> form.field1 + ",'" +
> form.field2 + "','" +
> .....
> form.field15 + "')"
>
> and write your own handling of database errors
>
> or  could write:
>
> // copy form variable to an instance of your data class
> BeanUtils.copyProperties(metric,dynaForm);
>
> // Call to "persist" (save) the record
> MetricService.getInstance().makePersistent(metric);
>
> And there are MANY more reasons to use Hibernate over handcoding your
> own sql.  None of it having to do with "not having to know sql".
>
> Lee
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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


Mime
View raw message