Bugs item #1000758, was opened at 2004-07-30 10:25
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1000758&group_id=22866
Category: JBossCMP
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Juan Martinez (juanmartinez)
Assigned to: Nobody/Anonymous (nobody)
Summary: auto-increment and CMR
Initial Comment:
Hi.
I've a couple of CMP beans which uses auto-increment
for their primary keys -- only important fields below.
ejb-jar.xml:
<prim-key-class>java.lang.Integer</prim-key-class>
<cmp-version>2.x</cmp-version>
<cmp-field >
<field-name>id</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
jbosscmp-jdbc.xml:
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
<jdbc-type>INTEGER</jdbc-type>
<sql-type>SERIAL</sql-type>
<auto-increment/>
</cmp-field>
<entity-command name="postgresql-fetch-seq">
using PostgreSQL 7.4.x for the backend.
The primary keys are incremented correctly from their
sequence.
But when I define a CMR between two beans a foreign
key constaint between the tables aren't created;
preferredrelationmapping is foreign-key.
<problem>
Instead a sequence is generated for the column; f.ex:
"not null default nextval('public.b1_b2_seq'::text)"
</problem>
(\d tablename in PostgreSQL's PSQL)
I've tried to define with/without ejb-relation tags in the
jbosscmp-jdbc.xml file.
F.ex. in ejb-jar.xml:
<ejb-relation >
<ejb-relation-name>b1-b2</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>b1-has-b2</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>b1</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>b2ref</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>b2-belongs-to-b1</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<cascade-delete/>
<relationship-role-source >
<ejb-name>b2</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
But the problem are for all kinds of relationsships:
one-one, one-many and many-many.
I havn't tried with any other database since we only use
PostgreSQL, sorry.
Using both Branch_3_2 and HEAD.
Hope this gives you an idea -- otherwise let me know.
Juan
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1000758&group_id=22866
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development