Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #151

Re: EJB/CMP entity bean q

From "Arved Sandstrom" <arved.sandstrom@THRWHITE.remove-dii-this>
Subject Re: EJB/CMP entity bean q
Message-ID <T8s%j.407$cV.352@edtnps92> (permalink)
Newsgroups comp.lang.java.databases
References <Xns9AACC182BB80ESH15SGybs1ysmajw54s5@194.100.2.89>
Date 2011-04-27 15:22 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.programmer
"Donkey Hot" <spam@plc.is-a-geek.com> wrote in message 
news:Xns9AACC182BB80ESH15SGybs1ysmajw54s5@194.100.2.89...
> Ajay <ajay610@gmail.com> wrote in
> news:e5328074-9265-42d4-ad64-e9615489588a@m36g2000hse.googlegroups.com:
>
>>
>> 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
>>
>
> I just want to write efficient ejb code.. I'm quite new with ejb's.
>
> My job is to maintain an existing application, and we use XDoclet to
> generate code.  My snippet may not be perfect, as did not write that from
> work, where all the code is.
>
> We use JBoss for development, but I will not dive into it's code to see
> that ;D
>
> I was after well known best practises, if any exists. I believe there are
> good patterns, ejb techology is not anything new. I'm just a newbie with
> ejb..

The best pattern for update is simply this - ejbStore() is doing it in both 
cases. For CMP ejbStore() will be empty. For BMP, ejbStore() [which you 
write] acquires a connection, you set the values of the persistent fields in 
a PreparedStatement, and call executeUpdate on the PreparedStatement. You're 
not explicitly calling ejbStore() in either case.

In the BMP case, where you write the code, you are writing the literal SQL 
for the UPDATE in the ejbStore() method.

AFAIK the container is just going to do a straightforward SQL UPDATE in both 
cases.

The above comments are for EJB 2.x with no persistence frameworks.

AHS

---
 * 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 | NextPrevious in thread | Find similar


Thread

Re: EJB/CMP entity bean q "Donkey Hot" <donkey.hot@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
  Re: EJB/CMP entity bean q "Arved Sandstrom" <arved.sandstrom@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000

csiph-web