Hi
Following the instructions here:
https://docs.geoserver.org/stable/en/user/data/app-schema/mapping-file.html#sql-based-data-stores
This is the relevant part of my mapping file:
<AttributeMapping>
<targetAttribute>er:sourceReference</targetAttribute>
<jdbcMultipleValue>
<sourceColumn>eno</sourceColumn>
<targetTable>mv_er_sourcereference</targetTable>
<targetColumn>eno</targetColumn>
</jdbcMultipleValue>
<ClientProperty>
<name>xlink:href</name>
<value>href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>title</value>
</ClientProperty>
</AttributeMapping>
The er:sourceReference attribute doesn't take a string value, so the
'targetValue' field is left blank, the same way you might do a simple source
expression with a null OCQL value and client properties.
However, this throws an error:
java.lang.RuntimeException: java.lang.RuntimeException: Error applying mapping
with targetAttribute er:sourceReference
java.lang.RuntimeException: Error applying mapping with targetAttribute
er:sourceReference
Error applying mapping with targetAttribute er:sourceReference
Which in the logs is:
Caused by: java.lang.NullPointerException
at
org.geotools.data.complex.DataAccessMappingFeatureIterator.extractMultipleValues(DataAccessMappingFeatureIterator.java:909)
at
org.geotools.data.complex.DataAccessMappingFeatureIterator.setAttributeValue(DataAccessMappingFeatureIterator.java:653)
at
org.geotools.data.complex.DataAccessMappingFeatureIterator.computeNext(DataAccessMappingFeatureIterator.java:1345)
Which in my debugger suggests it is this line of code:
https://github.com/geotools/geotools/blob/8805a4640f62a56e6158762856eeb49ed70f4644/modules/extension/app-schema/app-schema/src/main/java/org/geotools/data/complex/DataAccessMappingFeatureIterator.java#L906
Object targetValue = jdbcMultipleValue.getTargetValue().evaluate(readFeature);
jdbcMultipleValue.getTargetValue() is null and therefore it throws an NPE
I'm not sure if this is a bug or by design, but my intent is to get multiple
references linked by xlink:href and xlink:title
Thanks
Michael
Geoscience Australia Disclaimer: This e-mail (and files transmitted with it) is
intended only for the person or entity to which it is addressed. If you are not
the intended recipient, then you have received this e-mail by mistake and any
use, dissemination, forwarding, printing or copying of this e-mail and its file
attachments is prohibited. The security of emails transmitted cannot be
guaranteed; by forwarding or replying to this email, you acknowledge and accept
these risks.
-------------------------------------------------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
If you want to request a feature or an improvement, also see this:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users