Yes I know that a byte is a primitive, but byte array (byte[]) is an object.
In my Entity Bean, this array represent a graphic (a jpg), one of my entity
bean can have more than one graphic (I represent it now with a List of
Graph).
------------
I changed my EJB to :
public class ResultBean implements EntityBean {
[...]
public String id;
[...]
public List graphs;
[...]
}
------------
Here is my Graph Object :
public class Graph implements Serializable {
public byte[] datas;
}
------------
And in my orion-ejb-jar.xml :
<cmp-field-mapping name="graphs">
<list-mapping table="graphics">
<value-mapping type="ubiquity.rapids.ejb.result.Graph">
<cmp-field-mapping>
<fields />
</cmp-field-mapping>
</value-mapping>
</list-mapping>
</cmp-field-mapping>
------------------
Now, when I deploy :
<snip>
Auto-creating table: create table results (id CHAR(255) not null primary
key, matlabCommand CHAR(255) null, numericResult BINARY null, graphCommand
CHAR(255) null, generatedOn timestamp null, producedBy CHAR(255) null)
Orion Launcher create table results (id CHAR(255) not null primary key,
matlabCommand CHAR(255) null, numericResult BINARY null, graphCommand
CHAR(255) null, generatedOn timestamp null, producedBy CHAR(255) null)
Auto-creating table: create table graphics (id CHAR(255) not null, datas
BINARY null)
Orion Launcher create table graphics (id CHAR(255) not null, datas BINARY
null)
Found 7 syntax errors in "C:/orion/Graph_ORList20.java":
33. [B __fieldTemp21;
<>
*** Syntax: Unexpected symbol ignored
92.
if((([B)null) == null) insertAllStatement.setNull(1,
java.sql.Types.LONGVARBINARY);
<>
*** Syntax: Unexpected symbol ignored
93. else
insertAllStatement.setBinaryStream(1, new
java.io.ByteArrayInputStream((([B)null)), (([B)null).length);
<>
*** Syntax: Unexpected symbol ignored
93. else
insertAllStatement.setBinaryStream(1, new
java.io.ByteArrayInputStream((([B)null)), (([B)null).length);
<>
*** Syntax: Unexpected symbol ignored
117.
if((([B)null) == null) insertAllStatement.setNull(1,
java.sql.Types.LONGVARBINARY);
<>
*** Syntax: Unexpected symbol ignored
118. else
insertAllStatement.setBinaryStream(1, new
java.io.ByteArrayInputStream((([B)null)), (([B)null).length);
<>
*** Syntax: Unexpected symbol ignored
118. else
insertAllStatement.setBinaryStream(1, new
java.io.ByteArrayInputStream((([B)null)), (([B)null).length);
<>
*** Syntax: Unexpected symbol ignored
Error compiling file:/C:/orion/applications/rapids/rapids-ejb-result.jar:
Error in source
</snip>
-----------------
All these errors in Graph_ORList20.java are just because Orion generate [B
insteed of byte[], so the compiler don't understand it... My question is :
Can I write my own Graph_ORList and tell Orion where it is or how can I
correct this error ? (Is this an Orion bug ??)
Thanks
Laurent
----- Original Message -----
From: "Tim Drury" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Monday, November 27, 2000 4:47 PM
Subject: RE: byte array OR mapping...
> >
> > The '[B' is the String returned when I do byte[].getClass().toString()
>
> I don't think you want to do that. Firstly, a byte is not a class.
> byte is a primitive like int, float, char, etc. which are not classes
> in Java (maybe you are a Smalltalk programmer?).
>
> Second, getClass().toString() isn't correct; you should have used
> getClass().getName() to get the name of a class. A Class is an
> object, and toString() usually returns a serialized version of
> that object (usually, not always).
>
> You should probably take your byte[] and place it in a class that
> implements java.io.Serializable. Most of the database mappings
> support placing that into a blob:
>
> <type-mapping="java.io.Serializable" name="blob">
>
> -tim
>