Comments on: EJB CMP/CMR example with JBoss+Xdoclet https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/ Friends of Oracle and Java Fri, 06 Mar 2015 01:45:01 +0000 hourly 1 http://wordpress.org/?v=4.1.1 By: CMR https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-401 Wed, 25 Oct 2006 23:43:20 +0000 /?p=90#comment-401 Did it and worked. In fact the CMR element -Container Managed Relations- is an obvious missing point. Do you know where I can get some good sources for CMR?
Thanks!

]]>
By: Carola https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-400 Thu, 22 Dec 2005 20:41:48 +0000 /?p=90#comment-400 Hi everyone:

I would like to know if there’s possible to generate querys in the .java’s bean with xdoclect, something like Jboss IDE or hibernate. I must define relationships and create new querys and can’t do enything of that with my Lomboz Eclipse plugin and Jboss server.

I would be greateful at any kind of help

]]>
By: Jens Wurm https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-399 Thu, 17 Nov 2005 19:05:56 +0000 /?p=90#comment-399 Regarding Comment 4, that’s because it’s after the “@jboss.target-relation” tag, which refers to the blind side of the relation. In the case which you mentioned, one would use the “@jboss.relation” tag, which makes it work from the other side.

It took me very long to figure this out…somehow most tutorials on the net use that kind of example with the CMR Relation on the blind side, which i personally find not very intuitive for a first example. When trying it with the tags on the side with the foreign key column this produces “unknown column in where query” exceptions.

]]>
By: Breno Leitao https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-398 Thu, 24 Feb 2005 12:15:32 +0000 /?p=90#comment-398 I did it and it works correctly (after some hacks :o)).
Now i want to make tests around it. need i use cactus? is there another solution?
I dont want to kludge without another ejb. :-(
Thank you
Breno Leitão.
http://lcr.icmc.usp.br

]]>
By: Arne v.Irmer https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-397 Mon, 06 Dec 2004 08:08:17 +0000 /?p=90#comment-397 For anyone who searches for good example code:
Maybe you like to look at
http://xpetstore.sourceforge.net/
It is quite simple but has no bedirection m:n relationship.

]]>
By: Arne v.Irmer https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-396 Tue, 30 Nov 2004 09:55:38 +0000 /?p=90#comment-396 I got it!!!!
“ss� and me have the following problem:
XDoclet generates an empty {field-name} and {column -name}.
Here is the reason for that behaviour:
We got the source via copy and paste from this website. This leads us to the following line:
related-pk-field="table1ID�

The closing quotation mark is non ASCII! This confuses XDoclet. Just replace it with the correct one (“) and everything works properly.

Yours
Arne

]]>
By: Zeger Hendrikse https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-395 Tue, 23 Nov 2004 11:54:14 +0000 /?p=90#comment-395 This example is part of quite a large project in Eclipse, hence it is not possible to compose such a JAR instantly. However, I think it is a very good idea. Moreover, the statistics show that many people are struggling with these issues and are consulting my post.

Although I cannot promise to deliver the JAR file tomorrow, I’ll do my best to make it available soon. If so, I’ll make a new post, instead of changing this one. Of course, I’ll leave a comment referring to the new post.

If anyone else already has such a JAR file (preferrably based on my example) and is willing to share his/her efforts with the rest of the world, please let me know.

Regards,

]]>
By: Arne v.Irmer https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-394 Tue, 23 Nov 2004 11:32:43 +0000 /?p=90#comment-394 It would be *very* nice if you can zip a complete working example (inclusive build.xml) and give it for download. Please.
Yours
Arne
Btw.: Your examplanations are very understandable.

]]>
By: Arne v.Irmer https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-393 Tue, 23 Nov 2004 11:28:41 +0000 /?p=90#comment-393 I got the same problems as “ss” has.
It would be *very* nice if you can zip a complete working example (inclusive build.xml) and give it for download. >> Please < <
Yours
Arne
Btw.: Your examplanations are very understandable.

]]>
By: Zeger Hendrikse https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-392 Mon, 08 Nov 2004 11:28:56 +0000 /?p=90#comment-392 From your comment I cannot see what you find confusing. I did not post the database schema, since the intention was to let the container create the schema for me. But now that the schema has been created, I can post it, of course!

An article is created in the Hypersonic database with this SQL statement:

CREATE TABLE ARTICLE(PUBLICATION_ID_FK VARCHAR(256) NOT NULL,TITLE VARCHAR(256),JOURNAL VARCHAR(256),YEAR INTEGER,VOLUME VARCHAR(256),NUMBER INTEGER,PAGES VARCHAR(256),MONTH VARCHAR(256),NOTE VARCHAR(256),CONSTRAINT PK_ARTICLE PRIMARY KEY(PUBLICATION_ID_FK))

The PUBLICATION_ID_FK is primary key and foreign key at the same time for the article table. This is sound, since we are dealing with a one-to-one relationship here.

A bibliography is created with:

CREATE TABLE BIBLIOGRAPHY(PUBLICATION_ID VARCHAR(256) NOT NULL,PUBLICATION_KEY VARCHAR(256),PUBLICATION_TYPE VARCHAR(256),ANNOTATE VARCHAR(256),CROSSREF VARCHAR(256),ABSTRACT VARCHAR(256),AFFILIATION VARCHAR(256),CONTENTS VARCHAR(256),COPYRIGHT VARCHAR(256),ISBN_ISSN VARCHAR(256),KEYWORDS VARCHAR(256),LANGUAGE VARCHAR(256),LCCN VARCHAR(256),LOCATION VARCHAR(256),SIZE INTEGER,MRNUMBER INTEGER,PRICE DECIMAL,URL VARCHAR(256),CATEGORY VARCHAR(256),CONSTRAINT PK_BIBLIOGRAPHY PRIMARY KEY(PUBLICATION_ID))

I hope this helped!

]]>
By: Matt Robinson https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-391 Mon, 08 Nov 2004 05:34:41 +0000 /?p=90#comment-391 Looks like you may have things the wrong way around? Isn’t Table 2 actually referring to Table 1? Rather confusing. Also I find the Concrete example even more confusing! It would be better accompanied by a database schema to refer to.

]]>
By: ss https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-390 Tue, 19 Oct 2004 00:10:13 +0000 /?p=90#comment-390 Thanks a lot for the tutorial. however,

i used the following in my ant build script, but i had problems generating the <key -fields/> in jbosscmp-jdbc.xml.
And hence i had problems deploying my bean. It threw the following exception.

org.jboss.deployment.DeploymentException: Atleast one role of a foreign-key mapped relationship must have key fields (or <primkey -field> is missing from ejb-jar.xml): ejb-relation-name=FolderMayContainDevices

Can you please help.

  &lt;relationships&gt;
    &lt;ejb -relation&gt;
      &lt;ejb -relation-name&gt;FolderMayContainDevices
      &lt;relation -table-mapping&gt;
      &lt;/relation&gt;

      &lt;ejb -relationship-role&gt;
          &lt;ejb -relationship-role-name&gt;FolderToDevices
      &lt;ejb -relationship-role&gt;&lt;ejb -relationship-role-name&gt;DeviceToFolder&lt;/ejb&gt;
          &lt;key -fields&gt;
             &lt;key -field&gt;
               &lt;field -name&gt;
               &lt;column -name&gt;
             &lt;/key&gt;
          &lt;/key&gt;

      &lt;/ejb&gt;
    &lt;/ejb&gt;
    &lt;ejb -relation&gt;
      &lt;ejb -relation-name&gt;FolderMayContainFoldersFolderToSubFolders
		  &lt;key -fields/&gt;

      &lt;/key&gt;
      &lt;ejb -relationship-role&gt;&lt;ejb -relationship-role-name&gt;FolderToParentFolder&lt;/ejb&gt;
          &lt;key -fields&gt;
             &lt;key -field&gt;
               &lt;field -name&gt;&lt;/field&gt;
               &lt;column -name&gt;&lt;/column&gt;
             &lt;/key&gt;
          &lt;/key&gt;

      &lt;/ejb&gt;

     &lt!--
       To add jboss relationships for beans not managed by XDoclet, add
       a file to your XDoclet merge directory called jbosscmp-jdbc-relationships.xml that contains
       the <ejb -relation> markups for those beans.
     --&gt;
  &lt;/&gt;
</ejb>

the build.xml was as follows:

      &lt;taskdef name = "ejbdoclettask"  classname = "xdoclet.modules.ejb.EjbDocletTask"  classpathref="xdoclet.class.path"/&gt;ejbdoclettask destdir="${doclet.gensrc.dir}"  mergedir="parent-fake-to-debug"
            excludedtags="@version,@author,@todo"  addedtags = "@xdoclet-generated at ${TODAY},@copyright The XDoclet T
eam, @author XDoclet,@version ${version}"   ejbspec="2.0" force="false" verbose="false"&gt;
                        &lt;fileset dir = "${source.dir}"&gt;
                                &lt;include name = "**/*.java"/&gt;
                        &lt;/include&gt;

                        &lt; !-- Comment the next two lines, if you do not want to e
xpose the Beans via the Remote Interface -->      <remoteinterface pattern= "{0}Remote"/&gt;
                        &lt;homeinterface pattern = "{0}Home"/&gt;
                        &lt;localinterface pattern = "{0}LocalInterface"/&gt;
                        &lt;localhomeinterface pattern = "{0}LocalHome"/&gt;
                        &lt;deploymentdescriptor destdir = "${jar.dir}/META-INF"/&gt;

                        &lt;utilobject kind="physical" includeGUID="true"/&gt;
                        &lt;entitypk /&gt;
                        &lt;jboss version="4.0"
                                destdir="${jar.dir}/META-INF"
                                validatexml="false"
                                generateRelations="true"
                                /&gt;


        &lt;/jboss&gt;&lt;/entitypk&gt;&lt;/utilobject&gt;&lt;/deploymentdescriptor&gt;&lt;/localhomeinterface&gt;&lt;/localinterface&gt;&lt;/homeinterface&gt;&lt;/remoteinterface&gt;&lt;/jboss&gt;&lt;/entitypk&gt;&lt;/utilobject&gt;&lt;/deploymentdescriptor&gt;&lt;/localhomeinterface&gt;&lt;/localinterface&gt;&lt;/homeinterface&gt;&lt;/remoteinterface&gt;&lt;/ejb&gt;
</remoteinterface></remoteinterface>
]]>
By: Janos Czako https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-389 Thu, 02 Sep 2004 14:24:24 +0000 /?p=90#comment-389 It was the first tutorial I found, which really helped me, to understand, how to make cmr with Xdoclet.
Thanks for it.
Janos

]]>
By: Zeger Hendrikse https://technology.amis.nl/2004/07/28/ejb-cmpcmr-example-with-jboss/#comment-388 Mon, 02 Aug 2004 08:02:04 +0000 /?p=90#comment-388 The promised follow-up is available here.

]]>