-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How 'SchemaExport' generates separate relationship tables?
PostPosted: Mon Jan 15, 2007 2:00 am 
Newbie

Joined: Sun Feb 05, 2006 7:46 pm
Posts: 18
I've been caught in a bind for last two days. Please help...

From the code below 'SchemaExport' generates the table, "AccountRecords_Record", and three fields, "AccountRecords_id", "creditRecordList_hbm_id", and "debitRecordList_hbm_id" on that table.

This is fine... but...

Whenever I tried to make an 'AccountRecords' object persistent, I get an error message, "NULL value was tried to be inserted to the column, 'debitRecordList_hbm_id' on the table, 'AccountRecords_Record'.

Code:
@Entity
public class AccountRecords {
    private Long id;
    private List<Record> creditRecordList = new ArrayList<Record>();
    private List<Record> debitRecordList = new ArrayList<Record>();
   
    @OneToMany(cascade = CascadeType.ALL, targetEntity=Record.class)
    public List<Record> getCreaditRecordList() {
        return creditRecordList;
    }
    @OneToMany(cascade = CascadeType.ALL, targetEntity=Record.class)
    public List<Record> getDebitRecordList() {
        return debitRecordList;
    }
    // .....
}


It seems this is caused by having two "OneToMany" relationships i.e. creditRecordList_hbm_id and debitRecordList_hbm_id on the same table. Which annotation allows me to separate them? Or, is there any other solution to this problem?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 7:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ask in ejb3/jpa forum; sounds like something the annotation binder should complain about....

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.