Make your own free website on Tripod.com

InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE:Re: InstantDB: Problems with the getObject() method


Dear All,

It looks like that I have found a solution to my problem.

The objects that I tried to put in the database were simple
java.lang.Object. For whatever reason, those object are returned as byte
array by the getObject method.

I created then a serializable class to encapsulate the java.lang.Object.

Something like:

public class MedicalObject implements java.io.Serializable {

  private Object medicalObject;

  public MedicalObject(Object obj) { medicalObject = obj;
  }

  public String toString() { return medicalObject.toString();}

  public Object getMedicalObject() {
    return medicalObject;
  }

  public void setMedicalObject(Object newMedicalObject) {
    medicalObject = newMedicalObject;
  }
}

Saving the MedicalObject and retrieving it works fine.

I advice to everybody to use the admin tool from Fredy (see third party
tools), to look at the table in the database. If in the object column you
can see the result of the toString() method everything is fine; the Object
is well recognized. If you see something like ]B@12321, the application
cannot recognize your object and it will not be correctly returned by the
getObject method. Check then your classPath.

Regards,

Benoit


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Peter,

It looks like I have the same problem as Roni. When I save a java Object in
the database, it seems that I get an array of byte in return (creating
potentially a ClassCastException).

It is the same if I use jdk1.2.2 or 1.3.

The strange thing is that it was working fine before but I have no idea what
as changed in my application to create that problem.

It looks like InstantDB cannot recognize the class of the object thus
returning an array of byte.

Any clue??


Benoit

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Roni

> I saw in the mailing list an example of how to work with Java objects -
>
http://instantdb.enhydra.org/community/mailingLists/instantdb/msg00620.html
>
> I tried to run the attached program: simple.java,  and I got the same
failure:
>      java.lang.ClassCastException: [B
>            at simple.main(simple.java:33)

Sorry, but I'm at a loss to explain why simple.java should be generating a
ClassCastException. I've tried with JDK 1.3 as well and it seemed OK. All
InstantDB does is serialize the object to a byte array and then save that to
disk. It then does the reverse to retrieve it.

Any serialization experts out there who could hazard a guess at the possible
source of the problem? Anyone seen anything similar?

> Another question:  Is the function getObject(int i, Map map)  is supported
?
> If not, is it in the road map of InstantDB ?

Sorry - not at the moment.

Regards

Pete

--

Peter Hearty                         peter.hearty@lutris.com
Lutris Technologies (UK)        http://www.lutris.com
----- Original Message -----
From: <Roni_Nehamia@amat.com>
To: <instantdb@enhydra.org>
Sent: Tuesday, September 19, 2000 12:32 PM
Subject: InstantDB: Problems with the getObject() method


>
> Hello,
>
> I failed to retrieve a stored serialized Java object using the getObject()
> method.
> I saw in the mailing list an example of how to work with Java objects -
>
http://instantdb.enhydra.org/community/mailingLists/instantdb/msg00620.html
>
> I tried to run the attached program: simple.java,  and I got the same
failure:
>      java.lang.ClassCastException: [B
>            at simple.main(simple.java:33)
>
> What could be the problem ?
> I am working with JDK 1.3, InstantDB 3.20 Beta 1.
>
> Another question:  Is the function getObject(int i, Map map)  is supported
?
> If not, is it in the road map of InstantDB ?
>
> Thank you in advance,
> Roni.
>
>
>
>
> --------------------------------------------------------------------------
---
> To unsubscribe from this mailing list, send email to majordomo@enhydra.org
> with the text "unsubscribe instantdb" in the body of the email.
> If you have other questions regarding this mailing list, send email to
> the list admin at owner-instantdb@enhydra.org.
>

----------------------------------------------------------------------------
-
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.


----------------------------------------------------------------------------
-
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.


-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.