• 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

Please reply fast

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a doubt. Can EJB be used for an intranet application. We are developing an intranet website for our company. Will it be good idea if we use entity bean to retrive and store data from and to database and to use stateless session bean for performing business logic.
I feel we can complete this job just using servlets,jsp and jdbc. but by EJB technology will there be any use. and will it be possible in future to move this intranet website to internet.
thanks
arathi
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although an Entity bean can be used in bothe Internet and Intranet settings, most of the people that I have dealt with do not like to use Entity beans. The preferred method appears to be session beans and jdbc.
My suggestion would be to make a list of reasons to choose each configuration based on speed, security and ease of development.
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Arathi Raj:
Hi,
I have a doubt. Can EJB be used for an intranet application. We are developing an intranet website for our company. Will it be good idea if we use entity bean to retrive and store data from and to database and to use stateless session bean for performing business logic.
I feel we can complete this job just using servlets,jsp and jdbc. but by EJB technology will there be any use. and will it be possible in future to move this intranet website to internet.
thanks
arathi



If your requirements tell you that you can achieve your solution with servlets/jsp, then avoid EJB
[ September 10, 2003: Message edited by: Andres Gonzalez ]
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The fact that the application is for intranet use has no relevance on the decision to use or not use EJB. However, EJB for the sake of EJB is idiotic.
 
Arathi Raj
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
One more quick question. Can we use just stateful session bean to reterive and store data to and from database?
Thanks
Arathi
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Arathi Raj:
Hi,
One more quick question. Can we use just stateful session bean to reterive and store data to and from database?
Thanks
Arathi


yes.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi !
EJB approach is used to separate business logic from presentation logic.Choosing EJB(n-tier) vs servlets,jsp,odbc(3-tier) depends on various factors like scalability,maintainability,distributed transaction support ..etc.If the application grows in size, servlets,jsp and odbc will not scale up.
Using EntityBeans for small applications will be overkill.Instead you can go for DAOs.
It all depends on your application.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
EJB approach is used to separate business logic from presentation logic.


Not really. Nothing in EJB makes it inherently easier to separate business logic from presentation. I could as easily throw all my business logic in plain Java classes (POJO) and have just as nice of a separation.

Originally posted by Murthy Narasimha:
If the application grows in size, servlets,jsp and odbc will not scale up.


Sure they will. Servlet/JSP applications can be clustered just as easily as EJB applications, easier in fact. There is nothing in EJB that makes scalability inherently easier.

Originally posted by Murthy Narasimha:
Using EntityBeans for small applications will be overkill.Instead you can go for DAOs.


I won't comment much on this except to say that I think Entity Beans are pretty much useless for all applications... large and small.

Originally posted by Murthy Narasimha:
It all depends on your application.


At least we can agree on this.
[ September 11, 2003: Message edited by: Chris Mathews ]
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the advantages of J2EE is that one can concentrate on the business logic than concentrating on the middleware.
If some one wants to write their own middleware and miss the container facilities, I won't mind.
If u write JDBC code for an app, what if the databse vendor changes? do u rewrite the code again? what if u need your application needs to run many databases? Do u want to miss container services like caching and pooling?
Do u want to miss services like state management and write your own? What is the need of the app server then?

I think Entity Beans are pretty much useless for all applications... large and small.


I certainly don't agree with this
Performance is not the only issue in enterprise applications. Things like productivity and maintanability are also important.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
If u write JDBC code for an app, what if the databse vendor changes? do u rewrite the code again? what if u need your application needs to run many databases? Do u want to miss container services like caching and pooling?
Do u want to miss services like state management and write your own? What is the need of the app server then?


One word: Hibernate
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
Performance is not the only issue in enterprise applications. Things like productivity and maintanability are also important.


I completely 110% agree! Which is why I don't like Entity Beans. Notice I didn't say anything about performance. The biggest hit when it comes to Entity Beans is developer productivity, testability, and maintainance. Entity Beans lose out to a good O/R Mapper on all fronts.
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Few more points?
How will u handle distributed transactions?what about security? by writing ur own code (and probably miss deadlines)? do u want to miss RAD benifits of J2EE?
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris,
How many organization use hibernate? I havent heard many guys talk of hiberante. Why?
BTW, is your JMX timer article done?
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
How will u handle distributed transactions?what about security? by writing ur own code (and probably miss deadlines)? do u want to miss RAD benifits of J2EE?


EJB != Entity Beans.
I said that I don't like Entity Beans. However, I find Session Beans and MDBS perfectly good technologies. I can get all the benefits of EJB (minus the crappy persistance of Entity Beans) from using Session Beans.
Therefore, I will get my transaction management, security (which sucks in EJB anyways), and remoteability from a Service Layer built using Session Beans. Presto!!!
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Chris !
What you said about entity beans is true. But one should remember that entity beans are for representing coarse-grained data objects rather than fine-grained ones( which many people fail to recognize) . If one needs fine grained access then they should use other ways like DAOs.

But if your application needs coarse grained aceess then I think entity beans are the best solution.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does any one use the method level security in EJB.
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use method level security using caller roles ..etc. But what if security rules/roles change if u want to add new security rules/roles? you have to edit the EJB code. Instead you can specify security conditions in deployment descriptor.And change descriptor accordingly.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Murthy, you got me wrong. I wanted to know in real life who many define those roles.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
You can use method level security using caller roles ..etc. But what if security rules/roles change if u want to add new security rules/roles? you have to edit the EJB code. Instead you can specify security conditions in deployment descriptor.And change descriptor accordingly.


Unfortunately, most of the time in real applications the roles and users must change dynamically at runtime and modifying the DD doesn't cut it. This makes the standard security for J2EE pretty much unless because to do anything interesting you need to make calls to a vendor API.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
What you said about entity beans is true. But one should remember that entity beans are for representing coarse-grained data objects rather than fine-grained ones( which many people fail to recognize) . If one needs fine grained access then they should use other ways like DAOs.


The original intent of Entity Beans was to represent fine-grained data. People started using Composite Entity Beans (coarse-grained if you will) to work around the horrid performance of Entity Beans. With the release of EJB 2.0, which includes local interfaces, improved CMP, and CMR, the recommendation is back to not using coarse-grained Entity Beans. If you don't believe then check the lastest edition of Core J2EE (the bible of J2EE best practices). At no point in time were Entity Beans ever truely meant for representing coarse-grained data, it was just a hack.

Originally posted by Murthy Narasimha:
But if your application needs coarse grained aceess then I think entity beans are the best solution.


Coarse-grained access is best provided thru a Service Layer (possibly built on Session Beans). There is no reason why the client code needs to know what type of persistance technology is being used.
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Building your entity beans to be coarse-grained is a common performance optimization. It allows modeling the business objects with plain java classes rather than as entity beans, reducing the inter-remote object communication and transactional overhead associated with entity beans.
These plain classes typically have a life cycle dependent on a parent entity bean, do not have a distinct identity of their own and do not need to be referenced remotely by a client. For CMP, these objects are called dependent objects, and EJB 2.0 defines a standard way to define CMP dependent objects, leaving the complex task of persisting them to the underlying application server.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
Building your entity beans to be coarse-grained is a common performance optimization. It allows modeling the business objects with plain java classes rather than as entity beans, reducing the inter-remote object communication and transactional overhead associated with entity beans.


Exactly. So if much of our model is represented by POJO (by your own admission) and if we spend a lot of our time working around the performance problems with Entity Beans... then why even use them? What do Entity Beans offer that for all our trouble that Session Beans + POJO do not?
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Entity beans provide a clear model to represent persistent business objects in applications and their design. In object models, simple Java objects are normally represented in a straightforward way, but do not include the transactional persistence management functionality usually required for business objects.
Entity beans not only allow the same type of modelling and thinking about business objects in an object model, but they also encapsulate persistence mechanisms while hiding all complexity behind the bean and container services which is not the case with POJO.
This allows applications to manipulate them as Java object references. By hiding the persistent form and persistence mechanism from any calling code, entity beans allow for creative persistence optimizations by the container, while keeping the data store open and flexible, only to be determined at deployment time.
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Murthy Narasimha:
Entity beans provide a clear model to represent persistent business objects in applications and their design. In object models, simple Java objects are normally represented in a straightforward way, but do not include the transactional persistence management functionality usually required for business objects.
Entity beans not only allow the same type of modelling and thinking about business objects in an object model, but they also encapsulate persistence mechanisms while hiding all complexity behind the bean and container services which is not the case with POJO.
This allows applications to manipulate them as Java object references. By hiding the persistent form and persistence mechanism from any calling code, entity beans allow for creative persistence optimizations by the container, while keeping the data store open and flexible, only to be determined at deployment time.


That's all fine and good... if Entity Beans were the only technology to provide this. JDO and Hibernate both offer a far more powerful and transparent persistance mechanism then Entity Beans could ever hope to achieve... and they are based on POJO. All I have to do to make a POJO persistant is to tell JDO or Hibernate a little bit about it and *bang* I have a persistant object. It is much more natural to represent a Domain Model as regular Java classes then it is to shoehorn it into Entity Beans (especially pre-EJB 2.0).
[ September 12, 2003: Message edited by: Chris Mathews ]
 
Idly Vada
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that Chris is a strong supporter of JDO/hibernate :-)
we also considered JDOs in one of our projects. But I don't think JDO/hibernate will ever be added to the J2EE specification. Even container support remains a question. Will all container providers consider JDO/hibernate? Will they follow same standard/specification for them?
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It seems that Chris is a strong supporter of JDO/hibernate :-)


Particluarly of Hibernate I have created a thread comparing JDO and Hiberante. Some one bother to answer
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
Particluarly of Hibernate I have created a thread comparing JDO and Hiberante. Some one bother to answer


Hey!!!
I plan on responding. I just don't have time to formulate a decent response while I am here at work with deadlines hanging. I will try to get to this a bit later when I get home.
 
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

With the release of EJB 2.0, which includes local interfaces, improved CMP, and CMR, the recommendation is back to not using coarse-grained Entity Beans. If you don't believe then check the lastest edition of Core J2EE (the bible of J2EE best practices). At no point in time were Entity Beans ever truely meant for representing coarse-grained data, it was just a hack.


My copy of the 2nd ED arrived lasted week. The ink is still wet. But, I won't argue that it is up-to-date.
It is recommending using coarse grained entity beans.
Have you been reading Patterns of Enterprise Architecture or some web document?
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The arguement continues.... I always go for EJB when I am making justice to the container services. When I cant do justice to the container services I undoubtedly go for the POJO mechanism.
Cheers,
Gaya3

---------------------------------------
When U can decorate the wheel, why redesign ?
 
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would it be easier to load balance with EJBs than any other framework ?
I am still debating whether to bother with EJBs at all. seeing as there's still so much controversy surrounding it and there's so much to learn.
If you are writing components for networks would you still reject EJBs ?
I am guessing but I think most people responding are not writing re-usable components to be used with networks, unless that's what they mean by container services.
regards
[ October 02, 2003: Message edited by: HS Thomas ]
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps JDO and Hibernate deserves a separate forum? It's confusing this space no end.
regards
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic