Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #148
| From | "Ajay" <ajay@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: EJB/CMP entity bean q |
| Message-ID | <e5328074-9265-42d4-ad64-e9615489588a@m36g2000hse.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.databases |
| References | <Xns9AABE7861629FSH15SGybs1ysmajw54s5@194.10 |
| Date | 2011-04-27 15:22 +0000 |
| Organization | TDS.net |
To: comp.lang.java.programmer
On May 27, 3:45 pm, Donkey Hot <s...@plc.is-a-geek.com> wrote:
> Lets have an entitybean, say UserBean
>
> class UserBean extends EntityBean
> {
> Long id ;
> String name ;
> Integer height ;
> ...
> // and the getters and setters
>
> }
>
> // and the Local and Remote interfaces... and a POJO with similar
> // properties..
>
> How does the EJB (2.x) container generate SQL when updating entitybeans
> properties?
>
> I have seen code like this
>
> void updateUser(UserPOJO user)
> {
> UserLocal userLocal = UserLocalHome.findByPrimaryKey(
> new UserKey(user.getId()) ; // or something
>
> if (!user.getName().equals(userLocal.getName())
> userLocal.setName(user.getName()) ;
>
> if (!user.getHeight().equals(userLocal.getHeight())
> userLocal.setHeight(user.getHeight()) ;
>
> }
>
> Do the ejb setters mark properties as dirty, and generate SQL according to
> that, or would the end result be same, if the all properties would be
> always updated without checking if there is any difference?
The container is free to implement in whatever fashion their
respective hearts (or brains) desire.
Why is this of interest to you?
If this is an academic exercise, I suggest you look at jboss's code -
which I suspect uses hibernate under the wraps.
Ajay
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.databases | Previous | Next | Find similar
Re: EJB/CMP entity bean q "Ajay" <ajay@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
csiph-web