SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-617
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Shay Banon
Reporter: Dmitry Sklyut
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Compass

JDBC: indexing fails when using date converter for indexed column

Created: 11/Apr/08 02:52 PM   Updated: 11/Apr/08 02:52 PM
Component/s: Compass::Core, Compass::Gps
Affects Version/s: 1.2.1, 1.2.2
Fix Version/s: None

Environment: windows and linux


 Description  « Hide
Mapping

<bean class="org.compass.gps.device.jdbc.mapping.DataColumnToPropertyMapping">
<property name="columnName" value="last_price_date"/>
<property name="propertyName" value="lastPriceDate"/>
<property name="converter" value="date"/>
</bean>

ResultSetRowMarshallHelper.marshallMappedData(ResultSet rs) does: String value = dialect.getStringValue(rs, ctpMapping);
This string value is passed into org.compass.core.lucene.LuceneResource.addProperty(String name, Object value)
where addProperty in turn calls into converter:
String strValue = converter.toString(value, propertyMapping);
Converter in my case is org.compass.core.converter.basic.DateConverter. That delegates to SimpleDateFormat.format (or something similar) and that throws
java.lang.IllegalArgumentException because object is not of type Date or Number but a String.

A better approach would be IMHO to:
1. Allow user to specify the type of the column
2. Look up type of the column from ResultSetMetaData
and call a correct getter on resultSet based on that. It also calls for changes in the ResultSetRowMarshallHelper to pass around Object value vs. String value.

Dmitry



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.