Re: Issue java.io.StreamCorruptedException
Giuseppe De Rosa <[email protected]>
| Newsgroups | gmane.comp.java.cayenne.user |
|---|---|
| Message-ID | <pony-f0f51255567a554a98aa9c817ec57843e0a70a11-dc51ae532ef5af7f8466b3e179a8734a199c290e@user.cayenne.apache.org> |
So I need to modify the generated class, right? Actually for clob field I have this situation:
public void setRequest(String request) {
writeProperty(REQUEST, request);
}
public String getRequest() {
return (String)readProperty(REQUEST);
}
How to change it?
On 2020/10/31 15:33:57, Amedeo Mantica <[email protected]> wrote:
> I guess you should map it as
>
> org.apache.cayenne.access.types.CharType
>
> Amedeo
>
> > On 31 Oct 2020, at 15:51, Giuseppe De Rosa <[email protected]> wrote:
> >
> > I'm trying to make a simple select query but receive this error:
> >
> > java.io.StreamCorruptedException: invalid stream header: 78780A1F
> > at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:857)
> >
> > In datamap I have a db-attribute of type CLOB that I want read as a simple String.
> >
> > <db-entity name="DISC">
> > <db-attribute name="DATE" type="TIMESTAMP" isMandatory="true" length="7"/>
> > <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
> > <db-attribute name="FLAG" type="VARCHAR" isMandatory="true"/>
> > <db-attribute name="REQUEST" type="CLOB" isMandatory="false"/>
> > <db-key-generator>
> > <db-generator-type>ORACLE</db-generator-type>
> > <db-generator-name>DISC_SEQ</db-generator-name>
> > <db-key-cache-size>1</db-key-cache-size>
> > </db-key-generator>
> > </db-entity>
> > <obj-entity name="Disc" className="it.pack.dao.Disc" dbEntityName="DISC">
> > <obj-attribute name="date" type="java.time.LocalDateTime" db-attribute-path="DATE"/>
> > <obj-attribute name="id" type="java.lang.Integer" db-attribute-path="ID"/>
> > <obj-attribute name="flag" type="java.lang.String" db-attribute-path="FLAG"/>
> > <obj-attribute name="request" type="java.lang.String" db-attribute-path="REQUEST"/>
> > </obj-entity>
> >
> > I think that CLOB cannot map to java.lang.String but how can I read it?
>
>