norm icon indicating copy to clipboard operation
norm copied to clipboard

DbSerializer inoperative for array deserialization

Open jflamy opened this issue 8 years ago • 1 comments

The following code seems to demonstrate two bugs. @Column(name = "somename") @DbSerializer(JSONSerializer.class) private Integer card[][] = new Integer[Const.ACTUALLIFT + 1][Const.CJ3 + 1];

a). The serializer seems to work, but the deserializer does not seem to be invoked correctly, leading to a message when querying

com.dieselpoint.norm.DbException: Could not write value into pojo. Property: card method: public void org.owlcms.model.AthleteData.setCard(java.lang.Integer[][]) value: ((null, 50, 52, null, null, null), (50, 51, 52, 70, null, null), (null, 52, null, null, null, null), (null, null, null, null, null, null), (-50, 52, 0, null, null, null))
	at com.dieselpoint.norm.sqlmakers.StandardPojoInfo.putValue(StandardPojoInfo.java:256)
	at com.dieselpoint.norm.Query.results(Query.java:207)
	at org.owlcms.tests.database.NormTest.AthleteDataOutIn(NormTest.java:54)

Unit tests show that the serialize-deserialize pair works as in the following snippet Integer[][] card = athlete.getCard(); String serialized = new JSONSerializer().serialize(card); Integer[][] readCard = (Integer[][]) new JSONSerializer().deserialize(serialized, Integer[][].class);

b) The "@Column" annotation appears to be ignored.

jflamy avatar Apr 22 '17 22:04 jflamy

I know it's been two years, but I can look at this. I just added some support for arrays directly, so if your column is an array type, you may not need a serializer.

ccleve avatar May 20 '19 22:05 ccleve