File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity Bean Best Practice

 
Kelly Walker
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read that direct replication of the relational model with entity beans is bad practice. Good practice is to reduce inter entity bean communication and to create coarse grained entity beans.
I am using EJB2.x specification - CMP and CMR to model my business data. It seems a natural thing to simply replicate the existing relational model with entity beans. Why is this such bad practice.
How should I go about this in practice??
Thank you.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kelly Walker II:
I have read that direct replication of the relational model with entity beans is bad practice. Good practice is to reduce inter entity bean communication and to create coarse grained entity beans.

This was definitely true with regards to EJB 1.1. However EJB 2.0 is a large step forward and this best practice does not really hold true now that we have things like local interfaces, CMP 2.0, and CMR.
However, the current trend of best practices is to not use Entity Beans at all.
 
Kelly Walker
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you saying that CMP and CMR are a bad thing? How then should I create, update, delete, select data from my RDBMS. Do you advocate using only session beans and direct JDBC calls? Or did I muisunderstand?
 
Chris Mathews
Ranch Hand
Posts: 2712
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First off, since I don't know anything about your application, it is not clear that you need EJB at all.
Assuming that you are using EJB... I prefer to go with Session Bean + Hibernate (or plain JDBC if it is a simple application) over Entity Beans.
[ September 09, 2003: Message edited by: Chris Mathews ]
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate is a free software.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Hibernate is a free software.

To be more exact... it is OSS licensed under LGPL.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it mean that it is not free?
 
Kelly Walker
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sticking with just the J2EE specification, are you saying that I should give entity beans a wide berth? I use weblogic 8.1 btw.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Does it mean that it is not free?

No it is definitely free, however it is good to know what license you will have to abide by. For example, LGPL is less restraining than the standard GPL but still not as flexible as BSD or ASF licenses.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LGPL-licenced software is free and it allows your application to be closed-source and for-profit unlike with GPL, which is considered a "viral" licence (forcing your application to be GPL'd as well).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic