Originally posted by saahil sinha:
Hi ,
I would like to know when one should use container managed persistence and when to use bean managed persistence.And the advantages of one over the other.
CMP gives you a lot of things for free--you don't need to write SQL, you don't need to manage database connections, etc.
On the other hand, if you need more complicated queries that CMP's Query Language (EJB-QL) cannot be bent to, then it's probably better to use raw
JDBC or BMP. With BMP, you get life-cycle management for free but you need to write all database access code yourself.