An
Entity Bean is persistent. The persistence can be
CMP (container-managed persistence) or
BMP (bean-managed persistence). Each bean has a
primary key which is basically analogous to a rdbms primary key in that it uniquely identifies a specific bean. A bean can have transactional properties that allow it to participate in transactions, which are usually managed by the container.
A bean must have:
- Remote Interface (
Foo
) - business methods used by the client
- Home Interface (
FooHome
) - methods used by the client to create and find the bean
- Entity Bean Class (
FooEJB
) - the actual bean code
The entity bean class must:
- be declared
public
- implement
EntityBean
- have an empty constructor, and no finalize method
- implement zero or more
ejbCreate()
and ejbPostCreate()
methods
- more...
To learn more:
http://java.sun.com/j2ee/tutorial/doc/Entity.html , but the Account entity bean doesn't work with jboss because it holds the Connection instead of closing it for each method.
Although it's important to understand how all the various interfaces work, most of the code generation can be automated by a tool called EJBDoclet which is a clever little javadoc plugin.
--
TobyCabot - 03 Apr 2001
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding The Caboteria?
Send feedback