Hi,
Please help!
My Database has two tables:
"names"
- PK (primary key column)
- MEMBERS_PK (stores foreign key to "members" - Integer)
"members" table with a 1:1 bi-directinal relationship.
- PK (primary key column)
- NAMES_PK (stores foreign key to "names" - Integer)
I can make my Names Entity Bean work with the accessor fields, ejb-jar.xml and jbosscmp-jdbc.xml snipits shown below.
Note I can map the "pk" ben field implied by get/set Pk () to the all caps "PK" table column.
But I cannot find a way to map a differnt bean field namefor the relationship field associated with the MEMBERS_PK column.
I had to use get/setMEMBERS_PK () to make it work.
Can anyone tell me what I am missing?
I'd really like to:
- use get/SetMembersPk () in my bean and
- then map "membersPk" to the "MEMBERS_PK" table column.
using the <cmp-field> tag in jbosscmp-jdbc.xml file just gave me eroros or a giant bit blob being stored.
Names ENTITY BEAN SOURCE CODE // abstract relationship fields public abstract MemberLocal getMEMBERS_PK (); public abstract void setMEMBERS_PK (MemberLocal local); // abstract persistence fields public abstract Integer getPk (); public abstract void setId (Integer newId); ejb-jar.xml <ejb-jar> <enterprise-beans> <entity> <cmp-field><field-name>pk</field-name></cmp-field> </entity> </enterprise-beans> </ejb-jar> jbosscmp-jdbc.xml <jbosscmp-jdbc> <enterprise-beans> <entity> <cmp-field> <field-name>pk</field-name> <column-name>PK</column-name> <not-null/> <auto-increment/> </cmp-field> </entity> </enterprise-beans> </jbosscmp-jdbc>Please help.