-
1. Re: still no luck with CMR foreign key
abezafar Jul 1, 2002 2:52 PM (in response to gzhong)Man, you are not alone. I have the same exact problem: JBoss assumes that there is a column in my table. Don't get your hopes high for the docs either, I bought the docs and none of those examples there work either. I really believe this thing is not working, and I urge who ever that says it is working provide us with an example that does, so far I haven't seen one.
-
2. Re: still no luck with CMR foreign key
gzhong Jul 1, 2002 3:22 PM (in response to gzhong)Hmm, this is a bit frustrating; I thought they solved it for you, but apparently not. Yes, we definitely need some examples, be it with the distribution or part of the paid documentation. All I would need is some testing suite JBoss developers use to see how they did it. Since I am not one of the developers, I don't know how big a deal this is. It's better to see the entire set of classes and all the xml files. I suspect that our problem lies outside the "relations" tags of both xml files.
G -
3. Re: still no luck with CMR foreign key
dsundstrom Jul 1, 2002 3:43 PM (in response to gzhong)> Don't get your hopes high for the docs either,
> I bought the docs and none of those examples there
> work either. I really believe this thing is not
> working, and I urge who ever that says it is working
> provide us with an example that does, so far I
> haven't seen one.
All of the examples included with the JBoss documentation work perfectly. Flashline has a bug in it's software where it can send you an old copy of the documentation. Send flashline an email and you will get the new documentation.
CMRs work perfectly. To prove this let jboss create the tables for you. Unless you named on of your EJBs of field a SQL reserved word (a very bad idea) the application will deploy and run perfectly. -
4. Re: still no luck with CMR foreign key
gzhong Jul 1, 2002 4:58 PM (in response to gzhong)Hmm, so I thought, based on dsundstrom's message, that mine didn't work because my ejb name was Group. So I renamed it to UserGroup in every place. I still get the same error (except that the column is now UserGroup_users instead of just Group_users....)
So the docs that you are all talking about is for JBoss3.0?
G -
5. Re: still no luck with CMR foreign key
abezafar Jul 1, 2002 6:22 PM (in response to gzhong)Yes the docs that I am talking about is for jboss 3.0 cmp. Unfortunately they seem to be outdated.
-
-
7. Re: still no luck with CMR foreign key
gzhong Jul 1, 2002 9:57 PM (in response to gzhong)Hmm, well, abezafar, see if you can get an updated one and tell me if the examples there work.
Thanks!
G -
8. Re: still no luck with CMR foreign key
koval Jul 2, 2002 9:49 PM (in response to gzhong)I also wasn't "lucky" enough in one case.
The only thing i couldn't make it work was "unidirectional", otherwise CMR behaves quite good.
Now, Dan I don't know if I'm missing something, I downloaded WorkBook a few months ago and was able to deploy my EJBs long time ago, and let container to do the "magic". From the start I wasn't able to get rid of "bidirectional" relationships in the case of "1:1" relationship.
So in the case of the example from JBoss CMP-Docs I always get aditional field in MySQL USER table:
CustomerBean_userLocal referencing customer table
downloaded examples:
---------------------- ejb-jar--------------
<!--
ONE-TO-ONE unidirectional relationship:
User is unaware of Customer
-->
<ejb-relation>
<ejb-relation-name>Customer-User</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>customer-is-a-user</ejb-relationship-role-name>
One
<relationship-role-source>
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>userLocal</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>user-for-customer</ejb-relationship-role-name>
One
<relationship-role-source>
<ejb-name>UserEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
---------------
---------------jbosscmp-jdbc------------
<ejb-relation>
<ejb-relation-name>Customer-User</ejb-relation-name>
<foreign-key-mapping>
<ejb-relationship-role>
<ejb-relationship-role-name>customer-is-a-user</ejb-relationship-role-name>
<foreign-key-fields>
<foreign-key-field>
<field-name>userId</field-name>
<column-name>USER_ID</column-name>
</foreign-key-field>
</foreign-key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>user-for-customer</ejb-relationship-role-name>
<foreign-key-fields/>
</ejb-relationship-role>
</foreign-key-mapping>
</ejb-relation>
---------------------------------------------
How can I stop container to produce this aditional column. Is Documentation 2 months old good enough for JBOSS RC2 (I'm using) or I'm doing something wrong? -
9. Re: still no luck with CMR foreign key
dsundstrom Jul 2, 2002 10:25 PM (in response to gzhong)You need to upgrade to atleast JBoss 3.0. There have been a lot of bugs fixed since then. There is also new version of the documentation. The xml you are using for your jbosscmp-jdbc.xml file is very old. Check out the new dtd in the docs/dtd directory of the JBoss distribution.
-
10. Re: still no luck with CMR foreign key
koval Jul 2, 2002 10:40 PM (in response to gzhong)Thanks Dan,
I will as soon as I get some time, actually I'm using JBoss 3.0 RC2 and it's very stable, disregarding this issue. I wasted half day and couldn't get it working (unidirectionally), so I added adittional column in one of the tables, to get the App working.
Two question for you:
1. So is this issue solved (getting rid of bidir. refs) , do you get unidirectional 1:1 with latest workBook examples, and
2. Do I have to purchase Docs again (I did it two or three months ago) to downloaded newest version. -
11. Re: still no luck with CMR foreign key
dsundstrom Jul 3, 2002 1:51 AM (in response to gzhong)> Thanks Dan,
My name is Dain.
> 1. So is this issue solved (getting rid of bidir.
> refs) , do you get unidirectional 1:1 with latest
> workBook examples, and
Yes. Gangster-Hangout
> 2. Do I have to purchase Docs again (I did it two or
> three months ago) to downloaded newest version.
Yes, free upgrades only come with the subscriptions. -
12. Re: still no luck with CMR foreign key
koval Jul 3, 2002 1:54 PM (in response to gzhong)Thanks Dain,
You are the Ma(i)n!
(After all, you deserve some money for your hard work.) -
13. Re: still no luck with CMR foreign key
bsreekanth Jul 23, 2002 12:16 PM (in response to gzhong)Dain,
So is it true to say that we cannot have a foreign key as part of a primary key in the child table of a parent-child relationship? For example, let's say we have two tables, Organization and Personnel. Organization's have organization_id as PK and Personnel have organization_id and employee_id as PKs (assume that employee_id may not be unique due to company mergers so that we cannot just make employee_id as PK).
Since organization_id is part of the PK for Personnel, we have to declare it as a CMP field. But to define the 1-N relationship between Organization and Personnel, we need to declare organization_id as a <key-field> in the relationship. When an insert is performed with a new Personnel, it looks like the SQL generated duplicates an additonal organization_id? Is this correct or are we not mapping the relationship correctly?
Thanks,
Sreekanth -
14. Re: still no luck with CMR foreign key
dsundstrom Jul 24, 2002 1:37 AM (in response to gzhong)You can not have a foreign key a part of a primay key.