ObjectSelect property return type

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ObjectSelect property return type

Musall, Maik
Hi,

I have this query:

        ColumnSelect<Object[]> select = ObjectSelect
                .query( PDCMarketingInfo.class )
                .where( someExpression )
                .columns( PDCMarketingInfo.CUSTOMER, Property.COUNT )
                .select( context );

where PDCMarketingInfo.CUSTOMER is a to-one relationship to another entity. Each row returned is an Object[] of length 2, with the second being a Long as expected, but the first is a byte[6]. What is this byte array? If I convert it to Integer, I can't make sense of the resulting number as well.

I know there is a newer API with .columnQuery() in the works, and although I would be interested if that is a solution to this, I'd still like to stay on 4.0M5 for production use.

Thanks
Maik

Reply | Threaded
Open this post in threaded view
|

Re: ObjectSelect property return type

Andrus Adamchik
I suspect the byte[] result is a Java-serialized form of the target ID (serialized Integer or Long??). Not sure why it does it in this case. Could be a bug. But as you have guessed, this API behavior is already different in M6. Per CAY-2255 it will return a full entity [1]. So probably unsafe to rely on the current behavior (broken or not) anyways.

> I'd still like to stay on 4.0M5 for production use.

Understood. But note that M6 (likely to be renamed to B1) is quickly approaching. Could be a matter of weeks.

Andrus


[1] https://issues.apache.org/jira/browse/CAY-2255


> On May 4, 2017, at 5:05 PM, Musall, Maik <[hidden email]> wrote:
>
> Hi,
>
> I have this query:
>
> ColumnSelect<Object[]> select = ObjectSelect
> .query( PDCMarketingInfo.class )
> .where( someExpression )
> .columns( PDCMarketingInfo.CUSTOMER, Property.COUNT )
> .select( context );
>
> where PDCMarketingInfo.CUSTOMER is a to-one relationship to another entity. Each row returned is an Object[] of length 2, with the second being a Long as expected, but the first is a byte[6]. What is this byte array? If I convert it to Integer, I can't make sense of the resulting number as well.
>
> I know there is a newer API with .columnQuery() in the works, and although I would be interested if that is a solution to this, I'd still like to stay on 4.0M5 for production use.
>
> Thanks
> Maik
>