I just finished reading the JEE6 tutorial, and I am designing a web application; could @Entity beans also be @Managed beans? Is this a bad development practice?
Asked
Active
Viewed 267 times
2 Answers
1
@Managed
is generally employed to let the container (e.g. JavaEE app server) serve an instance of a bean on demand out of a pool of precreated items.
An @Entity
bean on the other hand is basically a representation of persisted data (e.g. from a database backend) in object form.
I don't think it is very reasonable to have both annotations at once, but I am not sure to be honest if it would work (I guess not).

fgysin
- 11,329
- 13
- 61
- 94
1
Yes they can be both, in fact with fully loaded domain objects it is preferable.
You can persist data, inject into other classes, and allow injection of other classes. All on the same object.

NimChimpsky
- 46,453
- 60
- 198
- 311