• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

When it is appropiate to have a EJB layer for doing database operations .

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on EJB Project , i am working on a existing code which was developed in 2005 .

The EJB version used is 2.1

In this code ,
sometimes data from Database is retrivied /inserted using EJB(Using JDBC internally) and sometimes this is done using plain JDBC , i mean without EJBLayer in between


Please tell me in whcih scenario , it is appropiate to have a EJB layer for doing database operations .

Thanks in advance .



 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You use EJBs when you need to sue the container provided services they can access.


sometimes data from Database is retrivied /inserted using EJB(Using JDBC internally) and sometimes this is done using plain JDBC


This just sounds like poor coding.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Paul .

As per the point you made :

You use EJBs when you need to sue the container provided services they can access.



My question is , it is better to have container provide services for DML operations or for also select statements .

Please advise , thank you .

 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends. Does you application need any of these services?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Does you application need any of these services?



Ya we have have some static data confiured in Database tables required for Java classes , so please tell me generally what does It depends mean exactly ??




 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, not following. What container provided services does the existence of static data in your application imply the need for?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul , thanks for the reply .
I have changed my question , my question is

For Select statements does does a EJB Layer is necessary ??

Please share your ideas , thanks in advance .
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, no, you just need JDBC for that.

But then, its not a question anyone should be using to choose between using EJBs or not.
 
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ravi Kiran Pattu wrote:
For Select statements does does a EJB Layer is necessary ??



Ravi Kiran,

First you need to understand what are the services provided by Container.
Then if your application needs those services, you will go for that. Its just not JDBC.
You can make JDBC calls from EJB(session beans) also.
Using Entity beans is not adviced for just retrival of data.
When working with JMS, MDB makes sence.
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic