Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] link table field doesn't have default value

Hi Tim,

No it's not a bug. If your intention was to re-use the join table between mappings than I would suggest entering an enhancement request.

Cheers,
Guy

On 27/07/2011 11:08 AM, Timothy Falconer wrote:
Guy,

That did the trick!  Thank you.  Is this is a bug, or simply an area where configuration by exception isn't happening?

Tim

--
Timothy Falconer
Immuexa Corporation
+ 1 610 797 3100 x33




On Jul 27, 2011, at 10:13 AM, Guy Pelletier wrote:

Timothy,

Your mappings should use separate join tables. Right now they default to use the same PERSON_ACTIVITY table causing the issue.

Add a @JoinTable specification to say choreList, e.g.

@JoinTable(name="PERSON_CHORE_ACTIVITY")

You can then leave hobbyList to use the default PERSON_ACTIVITY or specify a join table for it as well.

Cheers,
Guy

On 27/07/2011 8:20 AM, Timothy Falconer wrote:
hi all ... hopefully easy question regarding eclipselink ... I have two many-to-many relationships defined in an entity as follows:

Person.hobbyList -> Activity
Person.choreList -> Activity

EclipseLink (from Glassfish 3.1) creates a link table PERSON_ACTIVITY with the fields:
PERSON_ID, hobby_ID, chore_ID

when I try to add a hobby, it gives this error:
java.sql.SQLException: Field 'chore_ID' doesn't have a default value

MySQL does show a default value of NULL

I try removing the choreList and adding hobbies works.  I try removing the hobbyList and adding chores works.
The error only happens when I have two many-to-many's between the same two entities

what am I missing?
--
Timothy Falconer
Immuexa Corporation
http://immuexa.com
+ 1 610 797 3100 x33




_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top