Skip to main content

@ManyToOne doesn't do default mapping

1 reply [Last post]
cayhorstmann
Offline
Joined: 2003-06-13

If you try

@ManyToOne public Foo getFoo()

you get an error complaining about ambiguous mapping.

According to section 2.1.8.3.2 of the persistence spec, the default is to use a column FOO_ID.

A workaround is to use a @JoinColumn annotation, like this:

@ManyToOne @JoinColumn(name="FOO_ID")

There are a number of issues with these mapping defaults. Are these going to be addressed in the near future?

Thanks,

Cay

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
guypelletier
Offline
Joined: 2005-10-19

Hi Cay,

Yes this defaulting behavior is currently being addressed and should be available very soon.

Cheers,
Guy