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


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

Re: EJB/CMP entity bean q

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
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)
X-Comment-To comp.lang.java.programmer
Newsgroups comp.lang.java.databases
In-Reply-To <Xns9AACC182BB80ESH15SGybs1ysmajw54s5@194.100.2.89>
References <Xns9AACC182BB80ESH15SGybs1ysmajw54s5@194.100.2.89>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 50
Date Wed, 27 Apr 2011 15:22:02 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917722 96.60.20.240 (Wed, 27 Apr 2011 10:22:02 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:22:02 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.databases:151

Show key headers only | 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