4 Replies Latest reply on Jun 23, 2003 6:57 PM by Jon Martin Solaas

    CMR persisting into BLOBs?!

    Jason Chaucer Newbie

      I'm trying to set up a simple 1-n relationship with jboss 3.2 and mysql. The relationships work file, but when i look at the created tables, the table is not using foreign keys to persist relationships. Instead jbosscmp has created a BLOB ? Why is this and how do i configure jboss to use foreign keys? I've look all over the web and there are various configurations of the jbosscmp-jdbc.xml... but when i tried that, I got a "relation not a jbosscmp-jdbc-managed" error.

      Thanks.

        • 1. Re: CMR persisting into BLOBs?!
          Jason Chaucer Newbie

          When you define a cmr field, you don't need to define a cmp field for that field. If you do, the container will treat it as a BLOB and persist the serialized object. Pretty neat. But doesn't do what you want with the relationships.

          • 2. Re: CMR persisting into BLOBs?!
            Jon Martin Solaas Newbie

            Weird; I do that and jboss makes no blobs in my database. Say I have an Author EJB and an Article EJB - one-to-many relationship. Then, I declare the appropriate fields, "author" is a local interface type field in Article EJB, and "publications" is a collection field in Author EJB. Then I declare the relation, declaring "author" and "publications" to be the CMR-fields. No blobs in the database (PostgreSQL and MySQL), and jboss even creates the appropriate many-to-many-relation tables when need be (that is, when creatig many-to-many relationships), FK fields are created and used as appropriate, and everything seems to work the way it's supposed to work, at least according to everything I've read on the subject.

            How come jboss makes blobs when you do this? I use JDeveloper 9031 to create all my beans and descriptors.

            • 3. Re: CMR persisting into BLOBs?!
              Jason Chaucer Newbie

              Wow someone replied! Yeah I figured it out. I had the CMR fields declared in the CMP section of my descriptor too. I did my descriptors by hand... oops.

              Thanks for answering.

              • 4. Re: CMR persisting into BLOBs?!
                Jon Martin Solaas Newbie

                > I did my descriptors by hand...

                In MS world you have dll-hell, in the java-world you have xml-hell :-)