Attempting to read an array field from the database throws exception
--------------------------------------------------------------------
Key: CAY-996
URL: https://issues.apache.org/cayenne/browse/CAY-996
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 3.0
Environment: postgres sql 8.2
Reporter: Rares Ispas
Assignee: Andrus Adamchik
Priority: Minor
Does Cayenne really support array columns?
Here is my case:
CREATE TABLE supervisors
(
id bigint NOT NULL,
name character varying(30),
user_ids bigint[]
)
My map.xml contains:
<db-attribute name="user_ids" type="ARRAY" length="2147483647"/>
<obj-attribute name="userIds" type="java.lang.Long[]" db-attribute-path="user_ids"/>
When I try this code:
DataContext context = DataContext.createDataContext();
SelectQuery query = new SelectQuery( Supervisors.class );
List l = context.performQuery( query );
it throws this exception:
java.io.StreamCorruptedException: invalid stream header: 7B312C32
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at org.apache.cayenne.access.types.SerializableTypeFactory$SerializableType.toJavaObject(SerializableTypeFactory.java:109)
at org.apache.cayenne.access.types.ExtendedTypeDecorator.materializeObject(ExtendedTypeDecorator.java:54)
at org.apache.cayenne.access.jdbc.JDBCResultIterator.readDataRow(JDBCResultIterator.java:291)
at org.apache.cayenne.access.jdbc.JDBCResultIterator.nextDataRow(JDBCResultIterator.java:145)
at org.apache.cayenne.access.jdbc.JDBCResultIterator.dataRows(JDBCResultIterator.java:115)
at org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:142)
at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:57)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:236)
at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:446)
at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:67)
at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:418)
at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:853)
at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:415)
at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:119)
at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:746)
at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:282)
at org.apache.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:59)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1323)
at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1312)
at ScreenRecorder.db.SupervisorsDb.getAll(SupervisorsDb.java:15)
-- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
This archive was generated by hypermail 2.0.0 : Mon Mar 03 2008 - 12:56:08 EST