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


Groups > comp.lang.java.databases > #149 > unrolled thread

Re: EJB/CMP entity bean q

Started by"Donkey Hot" <donkey.hot@THRWHITE.remove-dii-this>
First post2011-04-27 15:22 +0000
Last post2011-04-27 15:22 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.databases

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#149 — Re: EJB/CMP entity bean q

From"Donkey Hot" <donkey.hot@THRWHITE.remove-dii-this>
Date2011-04-27 15:22 +0000
SubjectRe: EJB/CMP entity bean q
Message-ID<Xns9AACC182BB80ESH15SGybs1ysmajw54s5@194.100.2.89>
  To: comp.lang.java.programmer
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..

---
 * 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

[toc] | [next] | [standalone]


#151

From"Arved Sandstrom" <arved.sandstrom@THRWHITE.remove-dii-this>
Date2011-04-27 15:22 +0000
Message-ID<T8s%j.407$cV.352@edtnps92>
In reply to#149
  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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.databases


csiph-web