Originally posted by Sajee Joseph:
Whats the difference between Java Beans VS Data Transfer Objects.
An entity EJB is a Java class that maps to a persistence framework, typically some form of object-relational mapping tool or directly through your container. Being an EJB, it uses the container to access services like persistence, transactions, security, and the like. You should not normally access entity beans directly from your client application but rather through a session beans.
Typically in the presentation layer you need a different set of data about an entity bean -- either a subset or maybe a grouping of several beans together. The Data Transfer Object pattern is used here as a light-weight method of transfering the data you need between the two layers. Another example is value objects generated by XDoclet. These objects don't have any clue as to persistence, security, or transactions. They are simple collections of data -- you could use a Map or JavaBean or your own framework.