Many thanks Jeremy, to my embarrassment I've discovered that lead wasn't getting set properly on the other end of the association. I jumped to the wrong conclusion about the id generation not working... sorry for taking up your time with this.
On 02/mar/2011, at 21.42, Jeremy Bauer wrote: > Hi Phill, > > I tried a similar configuration, but was unable to reproduce the failure. > Since cascade is defined on the Lead-side of the relationship, I'm assuming > that you are persisting the Lead entity, right? I'm also assuming that > you've set all bi-directional references in your code. ie > answer.setLead(lead), lead.setAnswers(answers). If both of those > assumptions are correct, the next step would be to provide an OpenJPA trace > using: > > <property name="openjpa.Log" value="DefaultLevel=TRACE"/> > > please enable parameter value trace as well using: > > <property name="openjpa.ConnectionFactoryProperties" > value="PrintParameters=true"/> > > That may help us spot the problem. Or, if possible, please provide a simple > test that can be used to reproduce the problem. > > -Jeremy > > On Wed, Mar 2, 2011 at 11:08 AM, Phill <ph...@bicispace.com> wrote: > >> Yes it also uses a sequence generator. >> >> SurveyAnswer.java >> >> @SequenceGenerator(name = "Survey_Result_Id_Gen", sequenceName = >> "survey_result_seq", allocationSize = 10) >> >> @Id >> @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = >> "Survey_Result_Id_Gen") >> @Column(name = "result_id") >> protected long id; >> >> >> On 02/mar/2011, at 17.24, Jeremy Bauer wrote: >> >>> Thanks, Phill. Sorry, I forgot to ask - does SurveyAnswer also use the >> same >>> id generation strategy as Lead? In the meantime, I'll begin trying to >>> reproduce the failure you are seeing. >>> >>> -Jeremy >>> >>> On Wed, Mar 2, 2011 at 9:26 AM, Phill <ph...@bicispace.com> wrote: >>> >>>> OpenJPA 2.1.0 and PostgreSQL 9 >>>> I have separate DDL. >>>> Phill >>>> >>>> >>>> On 02/mar/2011, at 16.22, Jeremy Bauer wrote: >>>> >>>>> Hi Phill, >>>>> >>>>> What database and version of OpenJPA are you using? Also, does OpenJPA >>>>> generate the tables or do you have separate DDL? >>>>> >>>>> -Jeremy >>