Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbSerializer inoperative for array deserialization #16

Open
jflamy opened this issue Apr 22, 2017 · 1 comment
Open

DbSerializer inoperative for array deserialization #16

jflamy opened this issue Apr 22, 2017 · 1 comment

Comments

@jflamy
Copy link

jflamy commented Apr 22, 2017

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.

@ccleve
Copy link
Member

ccleve commented May 20, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants