EJB CMP/CMR example with JBoss+Xdoclet javacode 9085791

EJB CMP/CMR example with JBoss+Xdoclet

In this post I’ll first discuss how to implement a unidirectional one-to-one relationship with EJBs, JBoss and Xdoclet in abstracto, using two tables called table1 and table2. Thereafter I’ll present a concrete example, illustrated with (more detailed) code excerpts.

Disclaimer: this post is not meant to advocate the use of EJBs. It is solely meant to be technically informative.

Although this excellent tutorial gently introduces Container Managed Persistency (CMP) with entity beans, JBoss, Eclipse and Lomboz , it doesn’t address Container Managed Relations (CMR), which are essential to any non-trivial application.

Moreover, once you have implemented your relations, you will get the big bonus of the container setting up your database schema, if not present already. This means that you don’t have to deal with your database specific SQL extensions anymore [ZWH (23-08-’04): Hibernate does this as well]!

In this post I’ll focus on how to implement a unidirectional one-to-one relationship using EJBs, JBoss and Xdoclet. In subsequent posts I’ll talk a bit more about one-to-many and many-to-many relationships. But we have to start as simple as possible with these complex matters 😉

Let us first see how this is done generally, and then focus in on more details using a concrete example.


  1. CMR October 26, 2006
  2. Carola December 22, 2005
  3. Jens Wurm November 17, 2005
  4. Breno Leitao February 24, 2005
  5. Arne v.Irmer December 6, 2004
  6. Arne v.Irmer November 30, 2004
  7. Zeger Hendrikse November 23, 2004
  8. Arne v.Irmer November 23, 2004
  9. Arne v.Irmer November 23, 2004
  10. Zeger Hendrikse November 8, 2004
  11. Matt Robinson November 8, 2004
  12. ss October 19, 2004
  13. Janos Czako September 2, 2004
  14. Zeger Hendrikse August 2, 2004