Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Possible to map...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 3740 of 3747
Post > Topic >>

Possible to map M:M relationship with references to classes instead

by Spendius <spendius@[EMAIL PROTECTED] > May 5, 2008 at 05:28 AM

Hi,
I've been trying to implement a many-to-many relationship in
a JobHistory class related to my JOB_HISTORY table with
the following:
....
<class name="test.JobHistory" table="JOB_HISTORY">
  <composite-id>
<!--        following OK -->
<!--  <key-property name="empId" access="field" type="long"
column="EMPLOYEE_ID" />-->
<!--  <key-property name="jobId" access="field" type="long"
column="JOB_ID" />-->
       <key-property name="emp" access="test.Employee" type="object"
column="EMPLOYEE_ID" />
       <key-property name="job" access="test.Job" type="object"
column="JOB_ID" />
  </composite-id>
....
The first 2 lines commented run fine (with 'long' variables empId and
jobId in my class),
but when I try to replace these numeric references to class references
(and modify
my class accordingly:
  //Long empId;
    Employee emp;
  //String jobId;
    Job job;

    public JobHistory() {}

  //public JobHistory(Long eid, String jid)    {
    public JobHistory(Employee eid, Job jid)    {
    	emp=eid; job=jid;
    }
    ... etc.)
I get the following runtime error:
~ identifier mapping has wrong number of columns: \
~             test.JobHistory type: component[emp,job]

I found no solution.
In advance, thanks.
Spendius




 2 Posts in Topic:
Possible to map M:M relationship with references to classes inst
Spendius <spendius@[EM  2008-05-05 05:28:37 
Re: Possible to map M:M relationship with references to classes
Spendius <spendius@[EM  2008-05-05 06:45:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 22:38:12 CDT 2008.