I'm looking at the 1.3.x branch.

In AnnotationPersistenceMappingSerializer.java, line 510, when the
serializer begins its work of recording annotation information for columns,
it does so by consulting the FieldMapping's getMappingInfo().getColumns()
method.

OK; fine; push that on the mental stack.

But then at line 544, when the serializeColumn() method is trying to figure
out (among other things) what sorts of attributes to place on a @ManyToOne
annotation, it decides whether or not to output the "referencedColumnName"
attribute based on one of those column's getTarget() method.  But the kinds
of Columns returned by MappingInfo.getColumns() will never have targets set.

Consequently it looks to my naive eyes (and this matches behavior I'm also
seeing) that referencedColumnName will never be output.

I think instead it should be consulting the
MappingInfo.getForeignKey().getPrimaryKeyColumns() method instead for this
purpose, yes?

I will file a JIRA for this issue, but will retract it if someone can give
me a good explanation.

Thanks,
Laird

Reply via email to